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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-17 18:05:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 18:05:51 +0300
commit6fc8a74886a30f89562bb542ef3b24cc64b3208a (patch)
treedf0503b6cf4f6b762eca66b90f4360c495d624aa /source
parenta262ea8c47f8106f66e16935c556f383ef306861 (diff)
Cleanup: trailing space for blenkernel
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h10
-rw-r--r--source/blender/blenkernel/BKE_action.h16
-rw-r--r--source/blender/blenkernel/BKE_animsys.h4
-rw-r--r--source/blender/blenkernel/BKE_armature.h4
-rw-r--r--source/blender/blenkernel/BKE_cloth.h6
-rw-r--r--source/blender/blenkernel/BKE_constraint.h10
-rw-r--r--source/blender/blenkernel/BKE_context.h2
-rw-r--r--source/blender/blenkernel/BKE_customdata.h8
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h2
-rw-r--r--source/blender/blenkernel/BKE_displist.h2
-rw-r--r--source/blender/blenkernel/BKE_dynamicpaint.h2
-rw-r--r--source/blender/blenkernel/BKE_editmesh.h2
-rw-r--r--source/blender/blenkernel/BKE_effect.h6
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h16
-rw-r--r--source/blender/blenkernel/BKE_font.h6
-rw-r--r--source/blender/blenkernel/BKE_global.h4
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h2
-rw-r--r--source/blender/blenkernel/BKE_idprop.h2
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/BKE_material.h2
-rw-r--r--source/blender/blenkernel/BKE_modifier.h10
-rw-r--r--source/blender/blenkernel/BKE_node.h40
-rw-r--r--source/blender/blenkernel/BKE_ocean.h16
-rw-r--r--source/blender/blenkernel/BKE_paint.h4
-rw-r--r--source/blender/blenkernel/BKE_particle.h4
-rw-r--r--source/blender/blenkernel/BKE_property.h2
-rw-r--r--source/blender/blenkernel/BKE_report.h2
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h24
-rw-r--r--source/blender/blenkernel/BKE_writeavi.h2
-rw-r--r--source/blender/blenkernel/BKE_writeframeserver.h2
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c16
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c96
-rw-r--r--source/blender/blenkernel/intern/action.c308
-rw-r--r--source/blender/blenkernel/intern/anim.c140
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c744
-rw-r--r--source/blender/blenkernel/intern/appdir.c50
-rw-r--r--source/blender/blenkernel/intern/armature.c56
-rw-r--r--source/blender/blenkernel/intern/armature_update.c18
-rw-r--r--source/blender/blenkernel/intern/blender.c10
-rw-r--r--source/blender/blenkernel/intern/bmfont.c42
-rw-r--r--source/blender/blenkernel/intern/boids.c42
-rw-r--r--source/blender/blenkernel/intern/brush.c8
-rw-r--r--source/blender/blenkernel/intern/bullet.c12
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c8
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c60
-rw-r--r--source/blender/blenkernel/intern/cloth.c210
-rw-r--r--source/blender/blenkernel/intern/collision.c216
-rw-r--r--source/blender/blenkernel/intern/colortools.c122
-rw-r--r--source/blender/blenkernel/intern/constraint.c974
-rw-r--r--source/blender/blenkernel/intern/context.c12
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/customdata.c66
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c14
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c388
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c4
-rw-r--r--source/blender/blenkernel/intern/editmesh_bvh.c12
-rw-r--r--source/blender/blenkernel/intern/effect.c62
-rw-r--r--source/blender/blenkernel/intern/fcurve.c610
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c298
-rw-r--r--source/blender/blenkernel/intern/font.c88
-rw-r--r--source/blender/blenkernel/intern/gpencil.c168
-rw-r--r--source/blender/blenkernel/intern/group.c34
-rw-r--r--source/blender/blenkernel/intern/icons.c10
-rw-r--r--source/blender/blenkernel/intern/idcode.c6
-rw-r--r--source/blender/blenkernel/intern/idprop.c10
-rw-r--r--source/blender/blenkernel/intern/ipo.c630
-rw-r--r--source/blender/blenkernel/intern/key.c146
-rw-r--r--source/blender/blenkernel/intern/lamp.c18
-rw-r--r--source/blender/blenkernel/intern/lattice.c90
-rw-r--r--source/blender/blenkernel/intern/library.c42
-rw-r--r--source/blender/blenkernel/intern/library_remap.c4
-rw-r--r--source/blender/blenkernel/intern/material.c202
-rw-r--r--source/blender/blenkernel/intern/mball.c4
-rw-r--r--source/blender/blenkernel/intern/mesh.c92
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c34
-rw-r--r--source/blender/blenkernel/intern/modifier.c26
-rw-r--r--source/blender/blenkernel/intern/multires.c86
-rw-r--r--source/blender/blenkernel/intern/nla.c574
-rw-r--r--source/blender/blenkernel/intern/node.c520
-rw-r--r--source/blender/blenkernel/intern/object.c232
-rw-r--r--source/blender/blenkernel/intern/object_deform.c2
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c8
-rw-r--r--source/blender/blenkernel/intern/ocean.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c74
-rw-r--r--source/blender/blenkernel/intern/paint.c4
-rw-r--r--source/blender/blenkernel/intern/particle.c182
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c148
-rw-r--r--source/blender/blenkernel/intern/particle_system.c202
-rw-r--r--source/blender/blenkernel/intern/pbvh.c32
-rw-r--r--source/blender/blenkernel/intern/pointcache.c224
-rw-r--r--source/blender/blenkernel/intern/property.c26
-rw-r--r--source/blender/blenkernel/intern/report.c8
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c26
-rw-r--r--source/blender/blenkernel/intern/sca.c84
-rw-r--r--source/blender/blenkernel/intern/scene.c114
-rw-r--r--source/blender/blenkernel/intern/screen.c80
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c60
-rw-r--r--source/blender/blenkernel/intern/sequencer.c84
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c2
-rw-r--r--source/blender/blenkernel/intern/sketch.c34
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c8
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c80
-rw-r--r--source/blender/blenkernel/intern/suggestions.c2
-rw-r--r--source/blender/blenkernel/intern/text.c346
-rw-r--r--source/blender/blenkernel/intern/texture.c110
-rw-r--r--source/blender/blenkernel/intern/tracking_solver.c2
-rw-r--r--source/blender/blenkernel/intern/world.c14
-rw-r--r--source/blender/blenkernel/intern/writeavi.c10
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c46
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c6
-rw-r--r--source/blender/blenkernel/nla_private.h12
115 files changed, 4939 insertions, 4939 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 7b3df577111..89f3431fec8 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -301,12 +301,12 @@ struct DerivedMesh {
CustomData *(*getTessFaceDataLayout)(DerivedMesh * dm);
CustomData *(*getLoopDataLayout)(DerivedMesh * dm);
CustomData *(*getPolyDataLayout)(DerivedMesh * dm);
-
+
/** Copies all customdata for an element source into dst at index dest */
void (*copyFromVertCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
void (*copyFromEdgeCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
void (*copyFromFaceCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
-
+
/** Optional grid access for subsurf */
int (*getNumGrids)(DerivedMesh *dm);
int (*getGridSize)(DerivedMesh *dm);
@@ -315,7 +315,7 @@ struct DerivedMesh {
void (*getGridKey)(DerivedMesh *dm, struct CCGKey *key);
DMFlagMat *(*getGridFlagMats)(DerivedMesh * dm);
unsigned int **(*getGridHidden)(DerivedMesh * dm);
-
+
/** Iterate over each mapped vertex in the derived mesh, calling the
* given function with the original vert and the mapped vert's new
@@ -397,7 +397,7 @@ struct DerivedMesh {
* Also called for *final* editmode DerivedMeshes
*/
void (*drawEdges)(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdges);
-
+
/** Draw all loose edges (edges w/ no adjoining faces) */
void (*drawLooseEdges)(DerivedMesh *dm);
@@ -478,7 +478,7 @@ struct DerivedMesh {
*
* NOTE: This routine is optional!
*/
- void (*drawMappedEdgesInterp)(DerivedMesh *dm,
+ void (*drawMappedEdgesInterp)(DerivedMesh *dm,
DMSetDrawOptions setDrawOptions,
DMSetDrawInterpOptions setDrawInterpOptions,
void *userData);
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 1fda7f07343..90a3e4e6b99 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -69,7 +69,7 @@ void BKE_action_make_local(struct Main *bmain, struct bAction *act, const bool l
/* Action API ----------------- */
-/* types of transforms applied to the given item
+/* types of transforms applied to the given item
* - these are the return falgs for action_get_item_transforms()
*/
typedef enum eAction_TransformFlags {
@@ -79,21 +79,21 @@ typedef enum eAction_TransformFlags {
ACT_TRANS_ROT = (1 << 1),
/* scaling */
ACT_TRANS_SCALE = (1 << 2),
-
+
/* bbone shape - for all the parameters, provided one is set */
ACT_TRANS_BBONE = (1 << 3),
-
+
/* strictly not a transform, but custom properties are also
* quite often used in modern rigs
*/
ACT_TRANS_PROP = (1 << 4),
-
+
/* all flags */
ACT_TRANS_ONLY = (ACT_TRANS_LOC | ACT_TRANS_ROT | ACT_TRANS_SCALE),
ACT_TRANS_ALL = (ACT_TRANS_ONLY | ACT_TRANS_PROP)
} eAction_TransformFlags;
-/* Return flags indicating which transforms the given object/posechannel has
+/* Return flags indicating which transforms the given object/posechannel has
* - if 'curves' is provided, a list of links to these curves are also returned
* whose nodes WILL NEED FREEING
*/
@@ -132,7 +132,7 @@ struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char
/* Clear all 'temp' flags on all groups */
void action_groups_clear_tempflags(struct bAction *act);
-/* Pose API ----------------- */
+/* Pose API ----------------- */
void BKE_pose_channel_free(struct bPoseChannel *pchan);
void BKE_pose_channel_free_ex(struct bPoseChannel *pchan, bool do_id_user);
@@ -188,7 +188,7 @@ bool BKE_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan)
// XXX to be deprecated for a more general solution in animsys...
void framechange_poses_clear_unkeyed(struct Main *bmain);
-/* Bone Groups API --------------------- */
+/* Bone Groups API --------------------- */
/* Adds a new bone-group */
struct bActionGroup *BKE_pose_add_group(struct bPose *pose, const char *name);
@@ -198,7 +198,7 @@ void BKE_pose_remove_group(struct bPose *pose, struct bActionGroup *grp, const i
/* Remove the matching bone-group from its index */
void BKE_pose_remove_group_index(struct bPose *pose, const int index);
-/* Assorted Evaluation ----------------- */
+/* Assorted Evaluation ----------------- */
/* Used for the Action Constraint */
void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe);
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index b25f57b4be2..5cce1e090a9 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -80,10 +80,10 @@ void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id, const bool s
typedef enum eAnimData_MergeCopy_Modes {
/* Keep destination action */
ADT_MERGECOPY_KEEP_DST = 0,
-
+
/* Use src action (make a new copy) */
ADT_MERGECOPY_SRC_COPY = 1,
-
+
/* Use src action (but just reference the existing version) */
ADT_MERGECOPY_SRC_REF = 2
} eAnimData_MergeCopy_Modes;
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index f6de39c897e..0ccb4187732 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -53,10 +53,10 @@ typedef struct PoseTarget {
typedef struct PoseTree {
struct PoseTree *next, *prev;
-
+
int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */
int totchannel; /* number of pose channels */
-
+
struct ListBase targets; /* list of targets of the tree */
struct bPoseChannel **pchan; /* array of pose channels */
int *parent; /* and their parents */
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 6c517bd02df..c0d396fd115 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -67,7 +67,7 @@ typedef struct ClothHairData {
typedef struct ClothSolverResult {
int status;
-
+
int max_iterations, min_iterations;
float avg_iterations;
float max_error, min_error, avg_error;
@@ -138,7 +138,7 @@ typedef struct ClothSpring {
int flags; /* defined in BKE_cloth.h, e.g. deactivated due to tearing */
float stiffness; /* stiffness factor from the vertex groups */
float editrestlen;
-
+
/* angular bending spring target and derivatives */
float target[3];
}
@@ -203,7 +203,7 @@ struct CollPair;
typedef struct ColliderContacts {
struct Object *ob;
struct CollisionModifierData *collmd;
-
+
struct CollPair *collisions;
int totcollisions;
} ColliderContacts;
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 4e0eb5c65ac..d22a3becf37 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -51,10 +51,10 @@ typedef struct bConstraintOb {
struct Scene *scene; /* for system time, part of deglobalization, code nicer later with local time (ton) */
struct Object *ob; /* if pchan, then armature that it comes from, otherwise constraint owner */
struct bPoseChannel *pchan; /* pose channel that owns the constraints being evaluated */
-
+
float matrix[4][4]; /* matrix where constraints are accumulated + solved */
float startmat[4][4]; /* original matrix (before constraint solving) */
-
+
short type; /* type of owner */
short rotOrder; /* rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */
} bConstraintOb;
@@ -83,7 +83,7 @@ typedef struct bConstraintTypeInfo {
short size; /* size in bytes of the struct */
char name[32]; /* name of constraint in interface */
char structName[32]; /* name of struct for SDNA */
-
+
/* data management function pointers - special handling */
/* free any data that is allocated separately (optional) */
void (*free_data)(struct bConstraint *con);
@@ -93,13 +93,13 @@ typedef struct bConstraintTypeInfo {
void (*copy_data)(struct bConstraint *con, struct bConstraint *src);
/* set settings for data that will be used for bConstraint.data (memory already allocated using MEM_callocN) */
void (*new_data)(void *cdata);
-
+
/* target handling function pointers */
/* for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */
int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
/* for single-target constraints only: flush data back to source data, and the free memory used */
void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
-
+
/* evaluation */
/* set the ct->matrix for the given constraint target (at the given ctime) */
void (*get_target_matrix)(struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime);
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 6de323258bd..717e8c86ba3 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -304,6 +304,6 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
#ifdef __cplusplus
}
#endif
-
+
#endif
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 2cdda34b9b5..e178e12df14 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -221,8 +221,8 @@ void CustomData_copy_data_named(const struct CustomData *source,
struct CustomData *dest, int source_index,
int dest_index, int count);
void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count);
-void CustomData_bmesh_copy_data(const struct CustomData *source,
- struct CustomData *dest, void *src_block,
+void CustomData_bmesh_copy_data(const struct CustomData *source,
+ struct CustomData *dest, void *src_block,
void **dest_block);
/* frees data in a CustomData object
@@ -348,9 +348,9 @@ void CustomData_bmesh_free_block_data(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_bmesh_block(const struct CustomData *source,
+void CustomData_to_bmesh_block(const struct CustomData *source,
struct CustomData *dest, int src_index, void **dest_block, bool use_default_init);
-void CustomData_from_bmesh_block(const struct CustomData *source,
+void CustomData_from_bmesh_block(const struct CustomData *source,
struct CustomData *dest, void *src_block, int dest_index);
void CustomData_file_write_prepare(
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 0b81cfd4477..4af4f696b07 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -177,5 +177,5 @@ bool DAG_is_acyclic(struct Scene *scene);
#ifdef __cplusplus
}
#endif
-
+
#endif
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index f5c6fb37ccc..a9cfa7b14ed 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -1,4 +1,4 @@
-/*
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index cc1ff1a2375..937ed08a527 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -54,7 +54,7 @@ typedef struct PaintPoint {
} PaintPoint;
/* heigh field waves */
-typedef struct PaintWavePoint {
+typedef struct PaintWavePoint {
float height;
float velocity;
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h
index 55a9db9b1e5..92e311bb53f 100644
--- a/source/blender/blenkernel/BKE_editmesh.h
+++ b/source/blender/blenkernel/BKE_editmesh.h
@@ -56,7 +56,7 @@ typedef struct BMEditMesh {
/*this is for undoing failed operations*/
struct BMEditMesh *emcopy;
int emcopyusers;
-
+
/* we store tessellations as triplets of three loops,
* which each define a triangle.*/
struct BMLoop *(*looptris)[3];
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index aa45132cbe9..0a5e48030f4 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -97,7 +97,7 @@ typedef struct EffectorCache {
struct Object *ob;
struct ParticleSystem *psys;
struct SurfaceModifierData *surmd;
-
+
struct PartDeflect *pd;
/* precalculated for guides */
@@ -167,10 +167,10 @@ unsigned int BKE_sim_debug_data_hash_combine(unsigned int kx, unsigned int ky);
typedef struct SimDebugElement {
unsigned int category_hash;
unsigned int hash;
-
+
int type;
float color[3];
-
+
float v1[3], v2[3];
char str[64];
} SimDebugElement;
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 09f5ecce050..1dfcfd5e54f 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -66,7 +66,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
/* ************** F-Curve Drivers ***************** */
-/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
+/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
* accessed directly from the code using them, but it is not recommended that their
* values be changed to point at other slots...
*/
@@ -77,14 +77,14 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
DriverTarget *dtar = &dvar->targets[0]; \
int tarIndex = 0; \
for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
-
+
/* convenience looper over USED driver targets only */
#define DRIVER_TARGETS_USED_LOOPER(dvar) \
{ \
DriverTarget *dtar = &dvar->targets[0]; \
int tarIndex = 0; \
for (; tarIndex < dvar->num_targets; tarIndex++, dtar++)
-
+
/* tidy up for driver targets loopers */
#define DRIVER_TARGETS_LOOPER_END \
}
@@ -133,7 +133,7 @@ typedef struct FModifierTypeInfo {
short requires; /* eFMI_Requirement_Flags */
char name[64]; /* name of modifier in interface */
char structName[64]; /* name of struct for SDNA */
-
+
/* data management function pointers - special handling */
/* free any data that is allocated separately (optional) */
void (*free_data)(struct FModifier *fcm);
@@ -143,7 +143,7 @@ typedef struct FModifierTypeInfo {
void (*new_data)(void *mdata);
/* verifies that the modifier settings are valid */
void (*verify_data)(struct FModifier *fcm);
-
+
/* evaluation */
/* evaluate time that the modifier requires the F-Curve to be evaluated at */
float (*evaluate_modifier_time)(struct FCurve *fcu, struct FModifier *fcm, float cvalue, float evaltime);
@@ -229,7 +229,7 @@ struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]);
/* high level function to get an fcurve from C without having the rna */
struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven);
-/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
+/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
* e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone");
*/
int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName);
@@ -290,7 +290,7 @@ float calculate_fcurve(struct PathResolvedRNA *anim_rna, struct FCurve *fcu, flo
/* -------- Defines -------- */
-/* Basic signature for F-Curve sample-creation function
+/* Basic signature for F-Curve sample-creation function
* - fcu: the F-Curve being operated on
* - data: pointer to some specific data that may be used by one of the callbacks
*/
@@ -303,7 +303,7 @@ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime
/* -------- Main Methods -------- */
-/* Main API function for creating a set of sampled curve data, given some callback function
+/* Main API function for creating a set of sampled curve data, given some callback function
* used to retrieve the values to store.
*/
void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb);
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index bb1f97e83e6..d13cd4adff9 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -58,7 +58,7 @@ typedef struct EditFontSelBox {
typedef struct EditFont {
wchar_t *textbuf;
struct CharInfo *textbufinfo;
-
+
/* array of rectangles & rotation */
float textcurs[4][2];
EditFontSelBox *selboxes;
@@ -68,7 +68,7 @@ typedef struct EditFont {
* a copy of these is kept in Curve, but use these in editmode */
int len, pos;
int selstart, selend;
-
+
} EditFont;
@@ -76,7 +76,7 @@ bool BKE_vfont_is_builtin(struct VFont *vfont);
void BKE_vfont_builtin_register(void *mem, int size);
void BKE_vfont_free_data(struct VFont *vfont);
-void BKE_vfont_free(struct VFont *sc);
+void BKE_vfont_free(struct VFont *sc);
void BKE_vfont_init(struct VFont *vfont);
void BKE_vfont_copy_data(struct Main *bmain, struct VFont *vfont_dst, const struct VFont *vfont_src, const int flag);
struct VFont *BKE_vfont_builtin_get(void);
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index db816cb9e14..34eff9d7959 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -50,7 +50,7 @@ typedef struct Global {
/* active pointers */
struct Main *main;
-
+
/* strings: lastsaved */
char ima[1024], lib[1024]; /* 1024 = FILE_MAX */
@@ -229,5 +229,5 @@ extern Global G;
#ifdef __cplusplus
}
#endif
-
+
#endif
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index c7ea73463e3..3a951b7860d 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -88,7 +88,7 @@ bool gpencil_layer_is_editable(const struct bGPDlayer *gpl);
typedef enum eGP_GetFrame_Mode {
/* Use the preceeding gp-frame (i.e. don't add anything) */
GP_GETFRAME_USE_PREV = 0,
-
+
/* Add a new empty/blank frame */
GP_GETFRAME_ADD_NEW = 1,
/* Make a copy of the active frame */
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 8a2cdd7b37c..48a00462dd1 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -19,7 +19,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
#ifndef __BKE_IDPROP_H__
#define __BKE_IDPROP_H__
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index fc018dbfe81..9be75ac7736 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -216,7 +216,7 @@ void BKE_image_verify_viewer_views(const struct RenderData *rd, struct Image *im
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, bool *r_is_in_range);
-void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
+void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
void BKE_image_update_frame(const struct Main *bmain, int cfra);
/* sets index offset for multilayer files */
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 431d1df1ff6..e2f5fb23465 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -115,7 +115,7 @@ void free_matcopybuf(void);
void copy_matcopybuf(struct Main *bmain, struct Material *ma);
void paste_matcopybuf(struct Main *bmain, struct Material *ma);
-/* handle backward compatibility for tface/materials called from doversion */
+/* handle backward compatibility for tface/materials called from doversion */
int do_version_tface(struct Main *main);
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index e9ce91996e0..e414df1650a 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -197,7 +197,7 @@ typedef struct ModifierTypeInfo {
*
* The derivedData argument should always be non-NULL; the modifier
* should read the object data from the derived object instead of the
- * actual object data.
+ * actual object data.
*
* The useRenderParams argument indicates if the modifier is being
* applied in the service of the renderer which may alter quality
@@ -217,7 +217,7 @@ typedef struct ModifierTypeInfo {
/* Like applyModifier but called during editmode (for supporting
* modifiers).
- *
+ *
* The derived object that is returned must support the operations that
* are expected from editmode objects. The same qualifications regarding
* derivedData apply as for applyModifier.
@@ -232,7 +232,7 @@ typedef struct ModifierTypeInfo {
/* Initialize new instance data for this modifier type, this function
* should set modifier variables to their default values.
- *
+ *
* This function is optional.
*/
void (*initData)(struct ModifierData *md);
@@ -273,7 +273,7 @@ typedef struct ModifierTypeInfo {
bool (*isDisabled)(struct ModifierData *md, int userRenderParams);
/* Add the appropriate relations to the DEP graph depending on the
- * modifier data.
+ * modifier data.
*
* This function is optional.
*/
@@ -299,7 +299,7 @@ typedef struct ModifierTypeInfo {
/* True when a deform modifier uses normals, the requiredDataMask
* cant be used here because that refers to a normal layer where as
* in this case we need to know if the deform modifier uses normals.
- *
+ *
* this is needed because applying 2 deform modifiers will give the
* second modifier bogus normals.
* */
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 5439b16e211..a8459387b14 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -99,7 +99,7 @@ typedef struct bNodeSocketTemplate {
float min, max;
int subtype; /* would use PropertySubType but this is a bad level include to use RNA */
int flag;
-
+
/* after this line is used internal only */
struct bNodeSocket *sock; /* used to hold verified socket */
char identifier[64]; /* generated from name */
@@ -110,21 +110,21 @@ typedef struct bNodeSocketTemplate {
*/
typedef struct bNodeSocketType {
char idname[64]; /* identifier name */
-
+
void (*draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text);
void (*draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color);
-
+
void (*interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr);
void (*interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color);
void (*interface_register_properties)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct StructRNA *data_srna);
void (*interface_init_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path);
void (*interface_verify_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path);
void (*interface_from_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock);
-
+
/* RNA integration */
ExtensionRNA ext_socket;
ExtensionRNA ext_interface;
-
+
/* for standard socket types in C */
int type, subtype;
} bNodeSocketType;
@@ -141,23 +141,23 @@ typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat, struct bNode *node,
typedef struct bNodeType {
void *next, *prev;
short needs_free; /* set for allocated types that need to be freed */
-
+
char idname[64]; /* identifier name */
int type;
char ui_name[64]; /* MAX_NAME */
char ui_description[256];
int ui_icon;
-
+
float width, minwidth, maxwidth;
float height, minheight, maxheight;
short nclass, flag, compatibility;
-
+
/* templates for static sockets */
bNodeSocketTemplate *inputs, *outputs;
-
+
char storagename[64]; /* struct name for DNA */
-
+
/* Main draw function for the node */
void (*draw_nodetype)(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode,
struct bNodeTree *ntree, struct bNode *node, bNodeInstanceKey key);
@@ -183,41 +183,41 @@ typedef struct bNodeType {
int (*select_area_func)(struct bNode *node, int x, int y);
/// Optional tweak area polling (for grabbing).
int (*tweak_area_func)(struct bNode *node, int x, int y);
-
+
/// Called when the node is updated in the editor.
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
/// Check and update if internal ID data has changed.
void (*verifyfunc)(struct bNodeTree *ntree, struct bNode *node, struct ID *id);
-
+
/// Initialize a new node instance of this type after creation.
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node);
/// Free the node instance.
void (*freefunc)(struct bNode *node);
/// Make a copy of the node instance.
void (*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, struct bNode *src_node);
-
+
/* Registerable API callback versions, called in addition to C callbacks */
void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr);
void (*freefunc_api)(struct PointerRNA *ptr);
void (*copyfunc_api)(struct PointerRNA *ptr, struct bNode *src_node);
-
+
/* can this node type be added to a node tree */
int (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree);
/* can this node be added to a node tree */
int (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree);
-
+
/* optional handling of link insertion */
void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
/* Update the internal links list, for muting and disconnect operators. */
void (*update_internal_links)(struct bNodeTree *, struct bNode *node);
-
+
/* **** execution callbacks **** */
NodeInitExecFunction initexecfunc;
NodeFreeExecFunction freeexecfunc;
NodeExecFunction execfunc;
/* gpu */
NodeGPUExecFunction gpufunc;
-
+
/* RNA integration */
ExtensionRNA ext;
} bNodeType;
@@ -277,7 +277,7 @@ typedef struct bNodeTreeType {
char ui_name[64];
char ui_description[256];
int ui_icon;
-
+
/* callbacks */
void (*free_cache)(struct bNodeTree *ntree);
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
@@ -295,11 +295,11 @@ typedef struct bNodeTreeType {
/* Tree update. Overrides nodetype->updatetreefunc! */
void (*update)(struct bNodeTree *ntree);
-
+
int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
-
+
/* RNA integration */
ExtensionRNA ext;
} bNodeTreeType;
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
index 7a4c7d67040..3ea104e656a 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -1,4 +1,4 @@
-/*
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -35,7 +35,7 @@ typedef struct OceanResult {
float disp[3];
float normal[3];
float foam;
-
+
/* raw eigenvalues/vectors */
float Jminus;
float Jplus;
@@ -47,25 +47,25 @@ typedef struct OceanCache {
struct ImBuf **ibufs_disp;
struct ImBuf **ibufs_foam;
struct ImBuf **ibufs_norm;
-
+
const char *bakepath;
const char *relbase;
-
+
/* precalculated for time range */
float *time;
-
+
/* constant for time range */
float wave_scale;
float chop_amount;
float foam_coverage;
float foam_fade;
-
+
int start;
int end;
int duration;
int resolution_x;
int resolution_y;
-
+
int baked;
} OceanCache;
@@ -93,7 +93,7 @@ struct OceanCache *BKE_ocean_init_cache(
int start, int end, float wave_scale,
float chop_amount, float foam_coverage, float foam_fade, int resolution);
void BKE_ocean_simulate_cache(struct OceanCache *och, int frame);
-
+
void BKE_ocean_bake(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data);
void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v);
void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 253a615712c..abb9000b024 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -181,7 +181,7 @@ typedef struct SculptSession {
int totvert, totpoly;
struct KeyBlock *kb;
float *vmask;
-
+
/* Mesh connectivity */
const struct MeshElemMap *pmap;
@@ -206,7 +206,7 @@ typedef struct SculptSession {
/* Partial redraw */
bool partial_redraw;
-
+
/* Used to cache the render of the active texture */
unsigned int texcache_side, *texcache, texcache_actual;
struct ImagePool *tex_pool;
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index cba92eabb0b..ddbf4025596 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -60,7 +60,7 @@ struct LinkNode;
struct KDTree;
struct RNG;
struct BVHTreeRay;
-struct BVHTreeRayHit;
+struct BVHTreeRayHit;
struct EdgeHash;
#define PARTICLE_COLLISION_MAX_COLLISIONS 10
@@ -192,7 +192,7 @@ typedef struct ParticleCollisionElement {
/* values interpolated from original data*/
float x0[3], x1[3], x2[3], p[3];
-
+
/* results for found intersection point */
float nor[3], vel[3], uv[2];
diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h
index c787e8e8ed1..d917a6b55e6 100644
--- a/source/blender/blenkernel/BKE_property.h
+++ b/source/blender/blenkernel/BKE_property.h
@@ -49,5 +49,5 @@ void BKE_bproperty_set(struct bProperty *prop, const char *str);
void BKE_bproperty_add(struct bProperty *prop, const char *str);
/* should really be called '_get_valstr()' or '_as_string()' */
void BKE_bproperty_set_valstr(struct bProperty *prop, char str[MAX_PROPSTRING]);
-
+
#endif
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 70feff17151..2a79c7f5d58 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -74,6 +74,6 @@ bool BKE_report_write_file(const char *filepath, ReportList *reports, const char
#ifdef __cplusplus
}
#endif
-
+
#endif
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 3c7274ca3c5..470aae40df9 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -29,7 +29,7 @@
* \ingroup blenkernel
* \brief API for Blender-side Rigid Body stuff
*/
-
+
#ifndef __BKE_RIGIDBODY_H__
#define __BKE_RIGIDBODY_H__
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index e00e2403dfc..8574e81c4e6 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -135,38 +135,38 @@ struct SeqEffectHandle {
/* constructors & destructor */
/* init is _only_ called on first creation */
void (*init)(struct Sequence *seq);
-
- /* number of input strips needed
+
+ /* number of input strips needed
* (called directly after construction) */
int (*num_inputs)(void);
-
+
/* load is called first time after readblenfile in
* get_sequence_effect automatically */
void (*load)(struct Sequence *seq);
-
+
/* duplicate */
void (*copy)(struct Sequence *dst, struct Sequence *src);
-
+
/* destruct */
void (*free)(struct Sequence *seq);
-
+
/* returns: -1: no input needed,
* 0: no early out,
* 1: out = ibuf1,
* 2: out = ibuf2 */
- int (*early_out)(struct Sequence *seq, float facf0, float facf1);
-
+ int (*early_out)(struct Sequence *seq, float facf0, float facf1);
+
/* stores the y-range of the effect IPO */
void (*store_icu_yrange)(struct Sequence *seq, short adrcode, float *ymin, float *ymax);
-
+
/* stores the default facf0 and facf1 if no IPO is present */
void (*get_default_fac)(struct Sequence *seq, float cfra, float *facf0, float *facf1);
-
+
/* execute the effect
* sequence effects are only required to either support
* float-rects or byte-rects
* (mixed cases are handled one layer up...) */
-
+
struct ImBuf * (*execute)(const SeqRenderData *context, struct Sequence *seq, float cfra, float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3);
@@ -273,7 +273,7 @@ void BKE_sequencer_cache_cleanup(void);
/* returned ImBuf is properly refed and has to be freed */
struct ImBuf *BKE_sequencer_cache_get(const SeqRenderData *context, struct Sequence *seq, float cfra, eSeqStripElemIBuf type);
-/* passed ImBuf is properly refed, so ownership is *not*
+/* passed ImBuf is properly refed, so ownership is *not*
* transferred to the cache.
* you can pass the same ImBuf multiple times to the cache without problems.
*/
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index ca295c51f5d..3bd0689a93a 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -38,7 +38,7 @@ extern "C" {
/* generic blender movie support, could move to own module */
-struct RenderData;
+struct RenderData;
struct ReportList;
struct Scene;
diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h
index 0837e9bce79..120ac53315b 100644
--- a/source/blender/blenkernel/BKE_writeframeserver.h
+++ b/source/blender/blenkernel/BKE_writeframeserver.h
@@ -36,7 +36,7 @@
extern "C" {
#endif
-struct RenderData;
+struct RenderData;
struct ReportList;
struct Scene;
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 792e9195f12..c6224da2fe0 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -277,7 +277,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a
ss->fMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
ss->meshIFC = *ifc;
-
+
ss->subdivLevels = subdivLevels;
ss->numGrids = 0;
ss->allowEdgeCreation = 0;
@@ -489,8 +489,8 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss)
ss->currentAge++;
- ss->oldVMap = ss->vMap;
- ss->oldEMap = ss->eMap;
+ ss->oldVMap = ss->vMap;
+ ss->oldEMap = ss->eMap;
ss->oldFMap = ss->fMap;
ss->vMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
@@ -592,7 +592,7 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
void **prevp;
CCGVert *v = NULL;
short seamflag = (seam) ? Vert_eSeam : 0;
-
+
if (ss->syncState == eSyncState_Partial) {
v = ccg_ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
if (!v) {
@@ -937,7 +937,7 @@ void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces, int num
for (j = 0; j < v->numFaces; j++)
if (!(v->faces[j]->flags & Face_eEffected))
break;
-
+
if (j == v->numFaces) {
arrayV[numV++] = v;
v->flags |= Vert_eEffected;
@@ -952,7 +952,7 @@ void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces, int num
for (j = 0; j < e->numFaces; j++)
if (!(e->faces[j]->flags & Face_eEffected))
break;
-
+
if (j == e->numFaces) {
e->flags |= Edge_eEffected;
arrayE[numE++] = e;
@@ -1550,11 +1550,11 @@ int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss)
void CCG_key(CCGKey *key, const CCGSubSurf *ss, int level)
{
key->level = level;
-
+
key->elem_size = ss->meshIFC.vertDataSize;
key->has_normals = ss->calcVertNormals;
key->num_layers = ss->meshIFC.numLayers;
-
+
/* if normals are present, always the last three floats of an
* element */
if (key->has_normals)
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 15469e3ae4b..9c0fc79a358 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -137,7 +137,7 @@ static MFace *dm_getTessFaceArray(DerivedMesh *dm)
if (!mface) {
int numTessFaces = dm->getNumTessFaces(dm);
-
+
if (!numTessFaces) {
/* Do not add layer if there's no elements in it, this leads to issues later when
* this layer is needed with non-zero size, but currently CD stuff does not check
@@ -145,7 +145,7 @@ static MFace *dm_getTessFaceArray(DerivedMesh *dm)
* added (sergey) */
return NULL;
}
-
+
mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
CustomData_set_layer_flag(&dm->faceData, CD_MFACE, CD_FLAG_TEMPORARY);
dm->copyTessFaceArray(dm, mface);
@@ -347,7 +347,7 @@ void DM_init(
dm->numPolyData = numPolys;
DM_init_funcs(dm);
-
+
dm->needsFree = 1;
dm->auto_bump_scale = -1.0f;
dm->dirty = 0;
@@ -758,7 +758,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
if (CustomData_has_layer(&dm->vertData, CD_SHAPEKEY)) {
KeyBlock *kb;
int uid;
-
+
if (ob) {
kb = BLI_findlink(&me->key->block, ob->shapenr - 1);
if (kb) {
@@ -784,7 +784,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
if (ob) {
BKE_mesh_texspace_copy_from_object(&tmp, ob);
}
-
+
/* not all DerivedMeshes store their verts/edges/faces in CustomData, so
* we set them here in case they are missing */
if (!CustomData_has_layer(&tmp.vdata, CD_MVERT)) {
@@ -864,18 +864,18 @@ void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb)
int a, totvert = dm->getNumVerts(dm);
float *fp;
MVert *mvert;
-
+
if (totvert == 0 || me->totvert == 0 || me->totvert != totvert) {
return;
}
-
+
if (kb->data) MEM_freeN(kb->data);
kb->data = MEM_malloc_arrayN(me->key->elemsize, me->totvert, "kb->data");
kb->totelem = totvert;
-
+
fp = kb->data;
mvert = dm->getVertDataArray(dm, CD_MVERT);
-
+
for (a = 0; a < kb->totelem; a++, fp += 3, mvert++) {
copy_v3_v3(fp, mvert->co);
}
@@ -1135,10 +1135,10 @@ void DM_interp_poly_data(
DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3])
{
DerivedMesh *dm = CDDM_from_mesh(me);
-
+
if (!dm)
return NULL;
-
+
if (vertCos) {
CDDM_apply_vert_coords(dm, vertCos);
}
@@ -1156,7 +1156,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
KeyBlock *kb;
md->scene = scene;
-
+
if (!(md->mode & eModifierMode_Realtime)) {
return NULL;
}
@@ -1164,11 +1164,11 @@ DerivedMesh *mesh_create_derived_for_modifier(
if (mti->isDisabled && mti->isDisabled(md, 0)) {
return NULL;
}
-
+
if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr - 1))) {
BKE_keyblock_convert_to_mesh(kb, me);
}
-
+
if (mti->type == eModifierTypeType_OnlyDeform) {
int numVerts;
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
@@ -1178,7 +1178,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
if (build_shapekey_layers)
add_shapekey_layers(dm, me, ob);
-
+
MEM_freeN(deformedVerts);
}
else {
@@ -1186,7 +1186,7 @@ DerivedMesh *mesh_create_derived_for_modifier(
if (build_shapekey_layers)
add_shapekey_layers(tdm, me, ob);
-
+
dm = modwrap_applyModifier(md, ob, tdm, 0);
ASSERT_IS_VALID_DM(dm);
@@ -1205,13 +1205,13 @@ static float (*get_editbmesh_orco_verts(BMEditMesh *em))[3]
/* these may not really be the orco's, but it's only for preview.
* could be solver better once, but isn't simple */
-
+
orco = MEM_malloc_arrayN(em->bm->totvert, sizeof(float) * 3, "BMEditMesh Orco");
BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
copy_v3_v3(orco[i], eve->co);
}
-
+
return orco;
}
@@ -1401,7 +1401,7 @@ static void calc_weightpaint_vert_color(
const int draw_flag)
{
float input = 0.0f;
-
+
bool show_alert_color = false;
if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
@@ -1633,35 +1633,35 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
{
KeyBlock *kb;
int i, j, tot;
-
+
if (!me->key)
return;
-
+
tot = CustomData_number_of_layers(&dm->vertData, CD_SHAPEKEY);
for (i = 0; i < tot; i++) {
CustomDataLayer *layer = &dm->vertData.layers[CustomData_get_layer_index_n(&dm->vertData, CD_SHAPEKEY, i)];
float (*cos)[3], (*kbcos)[3];
-
+
for (kb = me->key->block.first; kb; kb = kb->next) {
if (kb->uid == layer->uid)
break;
}
-
+
if (!kb) {
kb = BKE_keyblock_add(me->key, layer->name);
kb->uid = layer->uid;
}
-
+
if (kb->data)
MEM_freeN(kb->data);
-
+
cos = CustomData_get_layer_n(&dm->vertData, CD_SHAPEKEY, i);
kb->totelem = dm->numVertData;
kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), "kbcos DerivedMesh.c");
if (kb->uid == actshape_uid) {
MVert *mvert = dm->getVertArray(dm);
-
+
for (j = 0; j < dm->numVertData; j++, kbcos++, mvert++) {
copy_v3_v3(*kbcos, mvert->co);
}
@@ -1672,12 +1672,12 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
}
}
}
-
+
for (kb = me->key->block.first; kb; kb = kb->next) {
if (kb->totelem != dm->numVertData) {
if (kb->data)
MEM_freeN(kb->data);
-
+
kb->totelem = dm->numVertData;
kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), "kb->data derivedmesh.c");
fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name);
@@ -1844,13 +1844,13 @@ static void mesh_calc_modifiers(
if (useDeform) {
if (inputVertexCos)
deformedVerts = inputVertexCos;
-
+
/* Apply all leading deforming modifiers */
for (; md; md = md->next, curr = curr->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene = scene;
-
+
if (!modifier_isEnabled(scene, md, required_mode)) {
continue;
}
@@ -1868,7 +1868,7 @@ static void mesh_calc_modifiers(
else {
break;
}
-
+
/* grab modifiers until index i */
if ((index != -1) && (BLI_findindex(&ob->modifiers, md) >= index))
break;
@@ -1883,7 +1883,7 @@ static void mesh_calc_modifiers(
if (build_shapekey_layers)
add_shapekey_layers(dm, me, ob);
-
+
if (deformedVerts) {
CDDM_apply_vert_coords(*r_deform, deformedVerts);
}
@@ -1899,7 +1899,7 @@ static void mesh_calc_modifiers(
/* Now apply all remaining modifiers. If useDeform is off then skip
- * OnlyDeform ones.
+ * OnlyDeform ones.
*/
dm = NULL;
orcodm = NULL;
@@ -2059,14 +2059,14 @@ static void mesh_calc_modifiers(
}
}
-
+
/* set the DerivedMesh to only copy needed data */
mask = curr->mask;
/* needMapping check here fixes bug [#28112], otherwise it's
* possible that it won't be copied */
mask |= append_mask;
DM_set_only_copy(dm, mask | (need_mapping ? CD_MASK_ORIGINDEX : 0));
-
+
/* add cloth rest shape key if needed */
if (mask & CD_MASK_CLOTH_ORCO)
add_orco_dm(ob, NULL, dm, clothorcodm, CD_CLOTH_ORCO);
@@ -2191,11 +2191,11 @@ static void mesh_calc_modifiers(
}
else {
finaldm = CDDM_from_mesh(me);
-
+
if (build_shapekey_layers) {
add_shapekey_layers(finaldm, me, ob);
}
-
+
if (deformedVerts) {
CDDM_apply_vert_coords(finaldm, deformedVerts);
}
@@ -2302,7 +2302,7 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *
modifier_setError(md, "Modifier requires original data, bad stack position");
return false;
}
-
+
return true;
}
@@ -2359,7 +2359,7 @@ static void editbmesh_calc_modifiers(
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene = scene;
-
+
if (!editbmesh_modifier_is_enabled(scene, md, dm)) {
continue;
}
@@ -2794,7 +2794,7 @@ DerivedMesh *mesh_get_derived_deform(Scene *scene, Object *ob, CustomDataMask da
DerivedMesh *mesh_create_derived_render(Scene *scene, Object *ob, CustomDataMask dataMask)
{
DerivedMesh *final;
-
+
mesh_calc_modifiers(
scene, ob, NULL, true, 1, false, dataMask, -1, false, false, false,
NULL, &final);
@@ -2839,7 +2839,7 @@ DerivedMesh *mesh_create_derived_no_deform(
CustomDataMask dataMask)
{
DerivedMesh *final;
-
+
mesh_calc_modifiers(
scene, ob, vertCos, false, 0, false, dataMask, -1, false, false, false,
NULL, &final);
@@ -2852,7 +2852,7 @@ DerivedMesh *mesh_create_derived_no_virtual(
CustomDataMask dataMask)
{
DerivedMesh *final;
-
+
mesh_calc_modifiers(
scene, ob, vertCos, false, -1, false, dataMask, -1, false, false, false,
NULL, &final);
@@ -2865,7 +2865,7 @@ DerivedMesh *mesh_create_derived_physics(
CustomDataMask dataMask)
{
DerivedMesh *final;
-
+
mesh_calc_modifiers(
scene, ob, vertCos, false, -1, true, dataMask, -1, false, false, false,
NULL, &final);
@@ -2991,13 +2991,13 @@ DMCoNo *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
Mesh *me = ob->data;
DerivedMesh *dm;
DMCoNo *vertexcosnos;
-
+
/* lets prevent crashing... */
if (ob->type != OB_MESH || me->totvert == 0)
return NULL;
-
+
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
-
+
if (dm->foreachMappedVert) {
vertexcosnos = MEM_calloc_arrayN(me->totvert, sizeof(DMCoNo), "vertexcosnos map");
dm->foreachMappedVert(dm, make_vertexcosnos__mapFunc, vertexcosnos);
@@ -3010,7 +3010,7 @@ DMCoNo *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
dm->getVertNo(dm, a, v_co_no->no);
}
}
-
+
dm->release(dm);
return vertexcosnos;
}
@@ -3703,7 +3703,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
vdata = &dm->vertData;
ldata = dm->getLoopDataLayout(dm);
-
+
/* calc auto bump scale if necessary */
if (dm->auto_bump_scale <= 0.0f)
DM_calc_auto_bump_scale(dm);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index fa36da8030e..eb7fefd423b 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -32,7 +32,7 @@
#include <string.h>
#include <math.h>
#include <stdlib.h>
-#include <stddef.h>
+#include <stddef.h>
#include "MEM_guardedalloc.h"
@@ -87,11 +87,11 @@
bAction *BKE_action_add(Main *bmain, const char name[])
{
bAction *act;
-
+
act = BKE_libblock_alloc(bmain, ID_AC, name, 0);
-
+
return act;
-}
+}
/* .................................. */
@@ -105,15 +105,15 @@ void BKE_action_make_local(Main *bmain, bAction *act, const bool lib_local)
/** Free (or release) any data used by this action (does not free the action itself). */
void BKE_action_free(bAction *act)
-{
+{
/* No animdata here. */
/* Free F-Curves */
free_fcurves(&act->curves);
-
+
/* Free groups */
BLI_freelistN(&act->groups);
-
+
/* Free pose-references (aka local markers) */
BLI_freelistN(&act->markers);
}
@@ -178,14 +178,14 @@ bAction *BKE_action_copy(Main *bmain, const bAction *act_src)
bActionGroup *get_active_actiongroup(bAction *act)
{
bActionGroup *agrp = NULL;
-
+
if (act && act->groups.first) {
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
if (agrp->flag & AGRP_ACTIVE)
break;
}
}
-
+
return agrp;
}
@@ -193,11 +193,11 @@ bActionGroup *get_active_actiongroup(bAction *act)
void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
{
bActionGroup *grp;
-
+
/* sanity checks */
if (act == NULL)
return;
-
+
/* Deactive all others */
for (grp = act->groups.first; grp; grp = grp->next) {
if ((grp == agrp) && (select))
@@ -216,7 +216,7 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
/* copy theme colors on-to group's custom color in case user tries to edit color */
bTheme *btheme = U.themes.first;
ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
-
+
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
@@ -242,69 +242,69 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
bActionGroup *action_groups_add_new(bAction *act, const char name[])
{
bActionGroup *agrp;
-
+
/* sanity check: must have action and name */
if (ELEM(NULL, act, name))
return NULL;
-
+
/* allocate a new one */
agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-
+
/* make it selected, with default name */
agrp->flag = AGRP_SELECTED;
BLI_strncpy(agrp->name, name[0] ? name : DATA_("Group"), sizeof(agrp->name));
-
+
/* add to action, and validate */
BLI_addtail(&act->groups, agrp);
BLI_uniquename(&act->groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name));
-
+
/* return the new group */
return agrp;
}
-/* Add given channel into (active) group
+/* Add given channel into (active) group
* - assumes that channel is not linked to anything anymore
* - always adds at the end of the group
*/
void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
-{
+{
/* sanity checks */
if (ELEM(NULL, act, agrp, fcurve))
return;
-
+
/* if no channels anywhere, just add to two lists at the same time */
if (BLI_listbase_is_empty(&act->curves)) {
fcurve->next = fcurve->prev = NULL;
-
+
agrp->channels.first = agrp->channels.last = fcurve;
act->curves.first = act->curves.last = fcurve;
}
-
- /* if the group already has channels, the F-Curve can simply be added to the list
+
+ /* if the group already has channels, the F-Curve can simply be added to the list
* (i.e. as the last channel in the group)
*/
else if (agrp->channels.first) {
- /* if the group's last F-Curve is the action's last F-Curve too,
+ /* if the group's last F-Curve is the action's last F-Curve too,
* then set the F-Curve as the last for the action first so that
* the lists will be in sync after linking
*/
if (agrp->channels.last == act->curves.last)
act->curves.last = fcurve;
-
+
/* link in the given F-Curve after the last F-Curve in the group,
* which means that it should be able to fit in with the rest of the
* list seamlessly
*/
BLI_insertlinkafter(&agrp->channels, agrp->channels.last, fcurve);
}
-
+
/* otherwise, need to find the nearest F-Curve in group before/after current to link with */
else {
bActionGroup *grp;
-
+
/* firstly, link this F-Curve to the group */
agrp->channels.first = agrp->channels.last = fcurve;
-
+
/* step through the groups preceding this one, finding the F-Curve there to attach this one after */
for (grp = agrp->prev; grp; grp = grp->prev) {
/* if this group has F-Curves, we want weave the given one in right after the last channel there,
@@ -318,18 +318,18 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
break;
}
}
-
+
/* if grp is NULL, that means we fell through, and this F-Curve should be added as the new first
- * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the
+ * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the
* second in the chain, etc. etc.
*/
if (grp == NULL)
BLI_insertlinkbefore(&act->curves, act->curves.first, fcurve);
}
-
+
/* set the F-Curve's new group */
fcurve->grp = agrp;
-}
+}
/* Remove the given channel from all groups */
void action_groups_remove_channel(bAction *act, FCurve *fcu)
@@ -337,11 +337,11 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu)
/* sanity checks */
if (ELEM(NULL, act, fcu))
return;
-
+
/* check if any group used this directly */
if (fcu->grp) {
bActionGroup *agrp = fcu->grp;
-
+
if (agrp->channels.first == agrp->channels.last) {
if (agrp->channels.first == fcu) {
BLI_listbase_clear(&agrp->channels);
@@ -359,10 +359,10 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu)
else
agrp->channels.last = NULL;
}
-
+
fcu->grp = NULL;
}
-
+
/* now just remove from list */
BLI_remlink(&act->curves, fcu);
}
@@ -373,7 +373,7 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
/* sanity checks */
if (ELEM(NULL, act, act->groups.first, name) || (name[0] == 0))
return NULL;
-
+
/* do string comparisons */
return BLI_findstring(&act->groups, name, offsetof(bActionGroup, name));
}
@@ -382,11 +382,11 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
void action_groups_clear_tempflags(bAction *act)
{
bActionGroup *agrp;
-
+
/* sanity checks */
if (ELEM(NULL, act, act->groups.first))
return;
-
+
/* flag clearing loop */
for (agrp = act->groups.first; agrp; agrp = agrp->next)
agrp->flag &= ~AGRP_TEMP;
@@ -402,10 +402,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
{
if (ELEM(NULL, pose, name) || (name[0] == '\0'))
return NULL;
-
+
if (pose->chanhash)
return BLI_ghash_lookup(pose->chanhash, (const void *)name);
-
+
return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
}
@@ -420,10 +420,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
{
bPoseChannel *chan;
-
+
if (pose == NULL)
return NULL;
-
+
/* See if this channel exists */
chan = BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
if (chan) {
@@ -432,7 +432,7 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
/* If not, create it and add it */
chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");
-
+
BLI_strncpy(chan->name, name, sizeof(chan->name));
chan->custom_scale = 1.0f;
@@ -441,20 +441,20 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
unit_qt(chan->quat);
unit_axis_angle(chan->rotAxis, &chan->rotAngle);
chan->size[0] = chan->size[1] = chan->size[2] = 1.0f;
-
+
chan->scaleIn = chan->scaleOut = 1.0f;
-
+
chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI;
chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI;
chan->stiffness[0] = chan->stiffness[1] = chan->stiffness[2] = 0.0f;
chan->ikrotweight = chan->iklinweight = 0.0f;
unit_m4(chan->constinv);
-
+
chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */
-
+
BLI_addtail(&pose->chanbase, chan);
BKE_pose_channels_hash_free(pose);
-
+
return chan;
}
@@ -494,7 +494,7 @@ bPoseChannel *BKE_pose_channel_active(Object *ob)
if ((pchan->bone) && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
return pchan;
}
-
+
return NULL;
}
@@ -543,11 +543,11 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
*dst = NULL;
return;
}
-
+
outPose = MEM_callocN(sizeof(bPose), "pose");
-
+
BLI_duplicatelist(&outPose->chanbase, &src->chanbase);
-
+
/* Rebuild ghash here too, so that name lookups below won't be too bad...
* BUT this will have the penalty that the ghash will be built twice
* if BKE_pose_rebuild() gets called after this...
@@ -556,12 +556,12 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
outPose->chanhash = NULL;
BKE_pose_channels_hash_make(outPose);
}
-
+
outPose->iksolver = src->iksolver;
outPose->ikdata = NULL;
outPose->ikparam = MEM_dupallocN(src->ikparam);
outPose->avs = src->avs;
-
+
for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) {
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
id_us_plus((ID *)pchan->custom);
@@ -583,7 +583,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
pchan->constraints = listb;
pchan->mpath = NULL; /* motion paths should not get copied yet... */
}
-
+
if (pchan->prop) {
pchan->prop = IDP_CopyProperty_ex(pchan->prop, flag);
}
@@ -593,7 +593,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
if (copy_constraints) {
BLI_duplicatelist(&outPose->agroups, &src->agroups);
}
-
+
*dst = outPose;
}
@@ -641,7 +641,7 @@ static bool pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
{
bConstraint *con;
Bone *bone;
-
+
/* No need to check if constraint is active (has influence),
* since all constraints with CONSTRAINT_IK_AUTO are active */
for (con = pchan->constraints.first; con; con = con->next) {
@@ -670,18 +670,18 @@ bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
* Removes the hash for quick lookup of channels, must
* be done when adding/removing channels.
*/
-void BKE_pose_channels_hash_make(bPose *pose)
+void BKE_pose_channels_hash_make(bPose *pose)
{
if (!pose->chanhash) {
bPoseChannel *pchan;
-
+
pose->chanhash = BLI_ghash_str_new("make_pose_chan gh");
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next)
BLI_ghash_insert(pose->chanhash, pchan->name, pchan);
}
}
-void BKE_pose_channels_hash_free(bPose *pose)
+void BKE_pose_channels_hash_free(bPose *pose)
{
if (pose->chanhash) {
BLI_ghash_free(pose->chanhash, NULL, NULL);
@@ -737,7 +737,7 @@ void BKE_pose_channels_remove(
cti->flush_constraint_targets(con, &targets, 0);
}
}
-
+
if (pchan->bbone_prev) {
if (filter_fn(pchan->bbone_prev->name, user_data))
pchan->bbone_prev = NULL;
@@ -746,7 +746,7 @@ void BKE_pose_channels_remove(
if (filter_fn(pchan->bbone_next->name, user_data))
pchan->bbone_next = NULL;
}
-
+
if (pchan->custom_tx) {
if (filter_fn(pchan->custom_tx->name, user_data))
pchan->custom_tx = NULL;
@@ -775,7 +775,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user)
}
BKE_constraints_free_ex(&pchan->constraints, do_id_user);
-
+
if (pchan->prop) {
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
@@ -794,11 +794,11 @@ void BKE_pose_channel_free(bPoseChannel *pchan)
void BKE_pose_channels_free_ex(bPose *pose, bool do_id_user)
{
bPoseChannel *pchan;
-
+
if (pose->chanbase.first) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next)
BKE_pose_channel_free_ex(pchan, do_id_user);
-
+
BLI_freelistN(&pose->chanbase);
}
@@ -852,7 +852,7 @@ void BKE_pose_free(bPose *pose)
static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan)
{
bConstraint *pcon, *con;
-
+
copy_v3_v3(pchan->loc, chan->loc);
copy_v3_v3(pchan->size, chan->size);
copy_v3_v3(pchan->eul, chan->eul);
@@ -863,7 +863,7 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
pchan->flag = chan->flag;
-
+
pchan->roll1 = chan->roll1;
pchan->roll2 = chan->roll2;
pchan->curveInX = chan->curveInX;
@@ -874,7 +874,7 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
pchan->ease2 = chan->ease2;
pchan->scaleIn = chan->scaleIn;
pchan->scaleOut = chan->scaleOut;
-
+
con = chan->constraints.first;
for (pcon = pchan->constraints.first; pcon && con; pcon = pcon->next, con = con->next) {
pcon->enforce = con->enforce;
@@ -908,7 +908,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
pchan->ikstretch = pchan_from->ikstretch;
pchan->ikrotweight = pchan_from->ikrotweight;
pchan->iklinweight = pchan_from->iklinweight;
-
+
/* bbone settings (typically not animated) */
pchan->bboneflag = pchan_from->bboneflag;
pchan->bbone_next = pchan_from->bbone_next;
@@ -946,31 +946,31 @@ void BKE_pose_update_constraint_flags(bPose *pose)
{
bPoseChannel *pchan, *parchan;
bConstraint *con;
-
+
/* clear */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
pchan->constflag = 0;
}
pose->flag &= ~POSE_CONSTRAINTS_TIMEDEPEND;
-
+
/* detect */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
-
+
pchan->constflag |= PCHAN_HAS_IK;
-
+
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0))
pchan->constflag |= PCHAN_HAS_TARGET;
-
+
/* negative rootbone = recalc rootbone index. used in do_versions */
if (data->rootbone < 0) {
data->rootbone = 0;
-
+
if (data->flag & CONSTRAINT_IK_TIP) parchan = pchan;
else parchan = pchan->parent;
-
+
while (parchan) {
data->rootbone++;
if ((parchan->bone->flag & BONE_CONNECTED) == 0)
@@ -981,10 +981,10 @@ void BKE_pose_update_constraint_flags(bPose *pose)
}
else if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) {
bFollowPathConstraint *data = (bFollowPathConstraint *)con->data;
-
+
/* for drawing constraint colors when color set allows this */
pchan->constflag |= PCHAN_HAS_CONST;
-
+
/* if we have a valid target, make sure that this will get updated on frame-change
* (needed for when there is no anim-data for this pose)
*/
@@ -993,7 +993,7 @@ void BKE_pose_update_constraint_flags(bPose *pose)
}
else if (con->type == CONSTRAINT_TYPE_SPLINEIK)
pchan->constflag |= PCHAN_HAS_SPLINEIK;
- else
+ else
pchan->constflag |= PCHAN_HAS_CONST;
}
}
@@ -1005,7 +1005,7 @@ void BKE_pose_tag_update_constraint_flags(bPose *pose)
pose->flag |= POSE_CONSTRAINTS_NEED_UPDATE_FLAGS;
}
-/* Clears all BONE_UNKEYED flags for every pose channel in every pose
+/* Clears all BONE_UNKEYED flags for every pose channel in every pose
* This should only be called on frame changing, when it is acceptable to
* do this. Otherwise, these flags should not get cleared as poses may get lost.
*/
@@ -1014,14 +1014,14 @@ void framechange_poses_clear_unkeyed(Main *bmain)
Object *ob;
bPose *pose;
bPoseChannel *pchan;
-
+
/* This needs to be done for each object that has a pose */
/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
/* we only need to do this on objects with a pose */
if ((pose = ob->pose)) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
- if (pchan->bone)
+ if (pchan->bone)
pchan->bone->flag &= ~BONE_UNKEYED;
}
}
@@ -1034,18 +1034,18 @@ void framechange_poses_clear_unkeyed(Main *bmain)
bActionGroup *BKE_pose_add_group(bPose *pose, const char *name)
{
bActionGroup *grp;
-
+
if (!name) {
name = DATA_("Group");
}
-
+
grp = MEM_callocN(sizeof(bActionGroup), "PoseGroup");
BLI_strncpy(grp->name, name, sizeof(grp->name));
BLI_addtail(&pose->agroups, grp);
BLI_uniquename(&pose->agroups, grp, name, '.', offsetof(bActionGroup, name), sizeof(grp->name));
-
+
pose->active_group = BLI_listbase_count(&pose->agroups);
-
+
return grp;
}
@@ -1055,13 +1055,13 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
{
bPoseChannel *pchan;
int idx = index;
-
+
if (idx < 1) {
idx = BLI_findindex(&pose->agroups, grp) + 1;
}
-
+
BLI_assert(idx > 0);
-
+
/* adjust group references (the trouble of using indices!):
* - firstly, make sure nothing references it
* - also, make sure that those after this item get corrected
@@ -1091,7 +1091,7 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
void BKE_pose_remove_group_index(bPose *pose, const int index)
{
bActionGroup *grp = NULL;
-
+
/* get group to remove */
grp = BLI_findlink(&pose->agroups, index - 1);
if (grp) {
@@ -1105,7 +1105,7 @@ void BKE_pose_remove_group_index(bPose *pose, const int index)
bool action_has_motion(const bAction *act)
{
FCurve *fcu;
-
+
/* return on the first F-Curve that has some keyframes/samples defined */
if (act) {
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
@@ -1113,7 +1113,7 @@ bool action_has_motion(const bAction *act)
return true;
}
}
-
+
/* nothing found */
return false;
}
@@ -1130,7 +1130,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
/* if curve has keyframes, consider them first */
if (fcu->totvert) {
float nmin, nmax;
-
+
/* get extents for this curve
* - no "selected only", since this is often used in the backend
* - no "minimum length" (we will apply this later), otherwise
@@ -1138,26 +1138,26 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
* a phantom frame (T50354)
*/
calc_fcurve_range(fcu, &nmin, &nmax, false, false);
-
+
/* compare to the running tally */
min = min_ff(min, nmin);
max = max_ff(max, nmax);
-
+
foundvert = 1;
}
-
+
/* if incl_modifiers is enabled, need to consider modifiers too
* - only really care about the last modifier
*/
if ((incl_modifiers) && (fcu->modifiers.last)) {
FModifier *fcm = fcu->modifiers.last;
-
+
/* only use the maximum sensible limits of the modifiers if they are more extreme */
switch (fcm->type) {
case FMODIFIER_TYPE_LIMITS: /* Limits F-Modifier */
{
FMod_Limits *fmd = (FMod_Limits *)fcm->data;
-
+
if (fmd->flag & FCM_LIMIT_XMIN) {
min = min_ff(min, fmd->rect.xmin);
}
@@ -1169,7 +1169,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */
{
FMod_Cycles *fmd = (FMod_Cycles *)fcm->data;
-
+
if (fmd->before_mode != FCM_EXTRAPOLATE_NONE)
min = MINAFRAMEF;
if (fmd->after_mode != FCM_EXTRAPOLATE_NONE)
@@ -1177,22 +1177,22 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
break;
}
/* TODO: function modifier may need some special limits */
-
+
default: /* all other standard modifiers are on the infinite range... */
min = MINAFRAMEF;
max = MAXFRAMEF;
break;
}
-
+
foundmod = 1;
}
}
}
-
+
if (foundvert || foundmod) {
/* ensure that action is at least 1 frame long (for NLA strips to have a valid length) */
if (min == max) max += 1.0f;
-
+
*start = min;
*end = max;
}
@@ -1202,7 +1202,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
}
-/* Return flags indicating which transforms the given object/posechannel has
+/* Return flags indicating which transforms the given object/posechannel has
* - if 'curves' is provided, a list of links to these curves are also returned
*/
short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
@@ -1211,7 +1211,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
FCurve *fcu;
char *basePath = NULL;
short flags = 0;
-
+
/* build PointerRNA from provided data to obtain the paths to use */
if (pchan)
RNA_pointer_create((ID *)ob, &RNA_PoseBone, pchan, &ptr);
@@ -1219,37 +1219,37 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
RNA_id_pointer_create((ID *)ob, &ptr);
else
return 0;
-
+
/* get the basic path to the properties of interest */
basePath = RNA_path_from_ID_to_struct(&ptr);
if (basePath == NULL)
return 0;
-
- /* search F-Curves for the given properties
+
+ /* search F-Curves for the given properties
* - we cannot use the groups, since they may not be grouped in that way...
*/
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
const char *bPtr = NULL, *pPtr = NULL;
-
+
/* if enough flags have been found, we can stop checking unless we're also getting the curves */
if ((flags == ACT_TRANS_ALL) && (curves == NULL))
break;
-
+
/* just in case... */
if (fcu->rna_path == NULL)
continue;
-
+
/* step 1: check for matching base path */
bPtr = strstr(fcu->rna_path, basePath);
-
+
if (bPtr) {
- /* we must add len(basePath) bytes to the match so that we are at the end of the
+ /* we must add len(basePath) bytes to the match so that we are at the end of the
* base path so that we don't get false positives with these strings in the names
*/
bPtr += strlen(basePath);
-
- /* step 2: check for some property with transforms
- * - to speed things up, only check for the ones not yet found
+
+ /* step 2: check for some property with transforms
+ * - to speed things up, only check for the ones not yet found
* unless we're getting the curves too
* - if we're getting the curves, the BLI_genericNodeN() creates a LinkData
* node wrapping the F-Curve, which then gets added to the list
@@ -1259,53 +1259,53 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
pPtr = strstr(bPtr, "location");
if (pPtr) {
flags |= ACT_TRANS_LOC;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_SCALE) == 0) {
pPtr = strstr(bPtr, "scale");
if (pPtr) {
flags |= ACT_TRANS_SCALE;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_ROT) == 0) {
pPtr = strstr(bPtr, "rotation");
if (pPtr) {
flags |= ACT_TRANS_ROT;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_BBONE) == 0) {
/* bbone shape properties */
pPtr = strstr(bPtr, "bbone_");
if (pPtr) {
flags |= ACT_TRANS_BBONE;
-
+
if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_PROP) == 0) {
/* custom properties only */
pPtr = strstr(bPtr, "[\""); /* extra '"' comment here to keep my texteditor functionlist working :) */
if (pPtr) {
flags |= ACT_TRANS_PROP;
-
+
if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
@@ -1313,10 +1313,10 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
}
}
}
-
+
/* free basePath */
MEM_freeN(basePath);
-
+
/* return flags found */
return flags;
}
@@ -1346,26 +1346,26 @@ void extract_pose_from_pose(bPose *pose, const bPose *src)
void BKE_pose_rest(bPose *pose)
{
bPoseChannel *pchan;
-
+
if (!pose)
return;
-
+
memset(pose->stride_offset, 0, sizeof(pose->stride_offset));
memset(pose->cyclic_offset, 0, sizeof(pose->cyclic_offset));
-
+
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
zero_v3(pchan->loc);
zero_v3(pchan->eul);
unit_qt(pchan->quat);
unit_axis_angle(pchan->rotAxis, &pchan->rotAngle);
pchan->size[0] = pchan->size[1] = pchan->size[2] = 1.0f;
-
+
pchan->roll1 = pchan->roll2 = 0.0f;
pchan->curveInX = pchan->curveInY = 0.0f;
pchan->curveOutX = pchan->curveOutY = 0.0f;
pchan->ease1 = pchan->ease2 = 0.0f;
pchan->scaleIn = pchan->scaleOut = 1.0f;
-
+
pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
}
}
@@ -1374,7 +1374,7 @@ void BKE_pose_rest(bPose *pose)
bool BKE_pose_copy_result(bPose *to, bPose *from)
{
bPoseChannel *pchanto, *pchanfrom;
-
+
if (to == NULL || from == NULL) {
printf("Pose copy error, pose to:%p from:%p\n", (void *)to, (void *)from); /* debug temp */
return false;
@@ -1391,16 +1391,16 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
if (pchanto) {
copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat);
copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
-
+
/* used for local constraints */
copy_v3_v3(pchanto->loc, pchanfrom->loc);
copy_qt_qt(pchanto->quat, pchanfrom->quat);
copy_v3_v3(pchanto->eul, pchanfrom->eul);
copy_v3_v3(pchanto->size, pchanfrom->size);
-
+
copy_v3_v3(pchanto->pose_head, pchanfrom->pose_head);
copy_v3_v3(pchanto->pose_tail, pchanfrom->pose_tail);
-
+
pchanto->roll1 = pchanfrom->roll1;
pchanto->roll2 = pchanfrom->roll2;
pchanto->curveInX = pchanfrom->curveInX;
@@ -1411,7 +1411,7 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
pchanto->ease2 = pchanfrom->ease2;
pchanto->scaleIn = pchanfrom->scaleIn;
pchanto->scaleOut = pchanfrom->scaleOut;
-
+
pchanto->rotmode = pchanfrom->rotmode;
pchanto->flag = pchanfrom->flag;
pchanto->protectflag = pchanfrom->protectflag;
@@ -1431,27 +1431,27 @@ void BKE_pose_tag_recalc(Main *bmain, bPose *pose)
DAG_relations_tag_update(bmain);
}
-/* For the calculation of the effects of an Action at the given frame on an object
+/* For the calculation of the effects of an Action at the given frame on an object
* This is currently only used for the Action Constraint
*/
void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
{
bActionGroup *agrp = BKE_action_group_find_name(act, groupname);
-
+
/* clear workob */
BKE_object_workob_clear(workob);
-
+
/* init workob */
copy_m4_m4(workob->obmat, ob->obmat);
copy_m4_m4(workob->parentinv, ob->parentinv);
copy_m4_m4(workob->constinv, ob->constinv);
workob->parent = ob->parent;
-
+
workob->rotmode = ob->rotmode;
-
+
workob->trackflag = ob->trackflag;
workob->upflag = ob->upflag;
-
+
workob->partype = ob->partype;
workob->par1 = ob->par1;
workob->par2 = ob->par2;
@@ -1459,7 +1459,7 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
workob->constraints.first = ob->constraints.first;
workob->constraints.last = ob->constraints.last;
-
+
workob->pose = pose; /* need to set pose too, since this is used for both types of Action Constraint */
if (pose) {
/* This function is most likely to be used with a temporary pose with a single bone in there.
@@ -1476,27 +1476,27 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
BLI_strncpy(workob->id.name, "OB<ConstrWorkOb>", sizeof(workob->id.name)); /* we don't use real object name, otherwise RNA screws with the real thing */
-
+
/* if we're given a group to use, it's likely to be more efficient (though a bit more dangerous) */
if (agrp) {
/* specifically evaluate this group only */
PointerRNA id_ptr;
-
+
/* get RNA-pointer for the workob's ID */
RNA_id_pointer_create(&workob->id, &id_ptr);
-
+
/* execute action for this group only */
animsys_evaluate_action_group(&id_ptr, act, agrp, NULL, cframe);
}
else {
AnimData adt = {NULL};
-
+
/* init animdata, and attach to workob */
workob->adt = &adt;
-
+
adt.recalc = ADT_RECALC_ANIM;
adt.action = act;
-
+
/* execute effects of Action on to workob (or it's PoseChannels) */
BKE_animsys_evaluate_animdata(NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM);
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 84a8a5d6e29..b3c6fb4f3a9 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -92,22 +92,22 @@ void animviz_settings_init(bAnimVizSettings *avs)
/* ------------------- */
/* Free the given motion path's cache */
-void animviz_free_motionpath_cache(bMotionPath *mpath)
+void animviz_free_motionpath_cache(bMotionPath *mpath)
{
/* sanity check */
- if (mpath == NULL)
+ if (mpath == NULL)
return;
-
+
/* free the path if necessary */
if (mpath->points)
MEM_freeN(mpath->points);
-
+
/* reset the relevant parameters */
mpath->points = NULL;
mpath->length = 0;
}
-/* Free the given motion path instance and its data
+/* Free the given motion path instance and its data
* NOTE: this frees the motion path given!
*/
void animviz_free_motionpath(bMotionPath *mpath)
@@ -115,10 +115,10 @@ void animviz_free_motionpath(bMotionPath *mpath)
/* sanity check */
if (mpath == NULL)
return;
-
+
/* free the cache first */
animviz_free_motionpath_cache(mpath);
-
+
/* now the instance itself */
MEM_freeN(mpath);
}
@@ -137,11 +137,11 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
{
bAnimVizSettings *avs;
bMotionPath *mpath, **dst;
-
+
/* sanity checks */
if (ELEM(NULL, scene, ob))
return NULL;
-
+
/* get destination data */
if (pchan) {
/* paths for posechannel - assume that posechannel belongs to the object */
@@ -169,9 +169,9 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
*/
if (*dst != NULL) {
int expected_length = avs->path_ef - avs->path_sf;
-
+
mpath = *dst;
-
+
/* path is "valid" if length is valid, but must also be of the same length as is being requested */
if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
/* outer check ensures that we have some curve data for this path */
@@ -190,13 +190,13 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath");
*dst = mpath;
}
-
+
/* set settings from the viz settings */
mpath->start_frame = avs->path_sf;
mpath->end_frame = avs->path_ef;
-
+
mpath->length = mpath->end_frame - mpath->start_frame;
-
+
if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS)
mpath->flag |= MOTIONPATH_FLAG_BHEAD;
else
@@ -212,10 +212,10 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
/* allocate a cache */
mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts");
-
+
/* tag viz settings as currently having some path(s) which use it */
avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS;
-
+
/* return it */
return mpath;
}
@@ -225,9 +225,9 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
/* Motion path needing to be baked (mpt) */
typedef struct MPathTarget {
struct MPathTarget *next, *prev;
-
+
bMotionPath *mpath; /* motion path in question */
-
+
Object *ob; /* source object */
bPoseChannel *pchan; /* source posechannel (if applicable) */
} MPathTarget;
@@ -241,28 +241,28 @@ typedef struct MPathTarget {
void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
{
MPathTarget *mpt;
-
+
/* object itself first */
if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) {
/* new target for object */
mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob");
BLI_addtail(targets, mpt);
-
+
mpt->mpath = ob->mpath;
mpt->ob = ob;
}
-
+
/* bones */
if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((pchan->bone) && (arm->layer & pchan->bone->layer) && (pchan->mpath)) {
/* new target for bone */
mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone");
BLI_addtail(targets, mpt);
-
+
mpt->mpath = pchan->mpath;
mpt->ob = ob;
mpt->pchan = pchan;
@@ -285,28 +285,28 @@ static void motionpaths_calc_optimise_depsgraph(Main *bmain, Scene *scene, ListB
{
Base *base, *baseNext;
MPathTarget *mpt;
-
+
/* make sure our temp-tag isn't already in use */
for (base = scene->base.first; base; base = base->next)
base->object->flag &= ~BA_TEMP_TAG;
-
+
/* for each target, dump its object to the start of the list if it wasn't moved already */
for (mpt = targets->first; mpt; mpt = mpt->next) {
for (base = scene->base.first; base; base = baseNext) {
baseNext = base->next;
-
+
if ((base->object == mpt->ob) && !(mpt->ob->flag & BA_TEMP_TAG)) {
BLI_remlink(&scene->base, base);
BLI_addhead(&scene->base, base);
-
+
mpt->ob->flag |= BA_TEMP_TAG;
-
+
/* we really don't need to continue anymore once this happens, but this line might really 'break' */
break;
}
}
}
-
+
/* "brew me a list that's sorted a bit faster now depsy" */
DAG_scene_relations_rebuild(bmain, scene);
}
@@ -322,11 +322,11 @@ static void motionpaths_calc_update_scene(Main *bmain, Scene *scene)
}
else { /* otherwise we can optimize by restricting updates */
Base *base, *last = NULL;
-
+
/* only stuff that moves or needs display still */
DAG_scene_update_flags(bmain, scene, scene->lay, true, false);
-
- /* find the last object with the tag
+
+ /* find the last object with the tag
* - all those afterwards are assumed to not be relevant for our calculations
*/
/* optimize further by moving out... */
@@ -334,14 +334,14 @@ static void motionpaths_calc_update_scene(Main *bmain, Scene *scene)
if (base->object->flag & BA_TEMP_TAG)
last = base;
}
-
+
/* perform updates for tagged objects */
/* XXX: this will break if rigs depend on scene or other data that
* is animated but not attached to/updatable from objects */
for (base = scene->base.first; base; base = base->next) {
/* update this object */
BKE_object_handle_update(bmain, bmain->eval_ctx, scene, base->object);
-
+
/* if this is the last one we need to update, let's stop to save some time */
if (base == last)
break;
@@ -363,21 +363,21 @@ static void motionpaths_calc_update_scene(Main *bmain, Scene *scene)
static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
{
MPathTarget *mpt;
-
+
/* for each target, check if it can be baked on the current frame */
for (mpt = targets->first; mpt; mpt = mpt->next) {
bMotionPath *mpath = mpt->mpath;
bMotionPathVert *mpv;
-
- /* current frame must be within the range the cache works for
+
+ /* current frame must be within the range the cache works for
* - is inclusive of the first frame, but not the last otherwise we get buffer overruns
*/
if ((CFRA < mpath->start_frame) || (CFRA >= mpath->end_frame))
continue;
-
+
/* get the relevant cache vert to write to */
mpv = mpath->points + (CFRA - mpath->start_frame);
-
+
/* pose-channel or object path baking? */
if (mpt->pchan) {
/* heads or tails */
@@ -387,7 +387,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
else {
copy_v3_v3(mpv->co, mpt->pchan->pose_tail);
}
-
+
/* result must be in worldspace */
mul_m4_v3(mpt->ob->obmat, mpv->co);
}
@@ -398,7 +398,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
}
}
-/* Perform baking of the given object's and/or its bones' transforms to motion paths
+/* Perform baking of the given object's and/or its bones' transforms to motion paths
* - scene: current scene
* - ob: object whose flagged motionpaths should get calculated
* - recalc: whether we need to
@@ -409,15 +409,15 @@ void animviz_calc_motionpaths(Main *bmain, Scene *scene, ListBase *targets)
MPathTarget *mpt;
int sfra, efra;
int cfra;
-
+
/* sanity check */
if (ELEM(NULL, targets, targets->first))
return;
-
+
/* set frame values */
cfra = CFRA;
sfra = efra = cfra;
-
+
/* TODO: this method could be improved...
* 1) max range for standard baking
* 2) minimum range for recalc baking (i.e. between keyframes, but how?) */
@@ -427,34 +427,34 @@ void animviz_calc_motionpaths(Main *bmain, Scene *scene, ListBase *targets)
efra = MAX2(efra, mpt->mpath->end_frame);
}
if (efra <= sfra) return;
-
+
/* optimize the depsgraph for faster updates */
/* TODO: whether this is used should depend on some setting for the level of optimizations used */
motionpaths_calc_optimise_depsgraph(bmain, scene, targets);
-
+
/* calculate path over requested range */
for (CFRA = sfra; CFRA <= efra; CFRA++) {
/* update relevant data for new frame */
motionpaths_calc_update_scene(bmain, scene);
-
+
/* perform baking for targets */
motionpaths_calc_bake_targets(scene, targets);
}
-
+
/* reset original environment */
CFRA = cfra;
motionpaths_calc_update_scene(bmain, scene);
-
+
/* clear recalc flags from targets */
for (mpt = targets->first; mpt; mpt = mpt->next) {
bAnimVizSettings *avs;
-
+
/* get pointer to animviz settings for each target */
if (mpt->pchan)
avs = &mpt->ob->pose->avs;
else
avs = &mpt->ob->avs;
-
+
/* clear the flag requesting recalculation of targets */
avs->recalc &= ~ANIMVIZ_RECALC_PATHS;
}
@@ -463,7 +463,7 @@ void animviz_calc_motionpaths(Main *bmain, Scene *scene, ListBase *targets)
/* ******************************************************************** */
/* Curve Paths - for curve deforms and/or curve following */
-/* free curve path data
+/* free curve path data
* NOTE: frees the path itself!
* NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633]
*/
@@ -473,7 +473,7 @@ void free_path(Path *path)
MEM_freeN(path);
}
-/* calculate a curve-deform path for a curve
+/* calculate a curve-deform path for a curve
* - only called from displist.c -> do_makeDispListCurveTypes
*/
void calc_curvepath(Object *ob, ListBase *nurbs)
@@ -486,17 +486,17 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
float *fp, *dist, *maxdist, xyz[3];
float fac, d = 0, fac1, fac2;
int a, tot, cycl = 0;
-
+
/* in a path vertices are with equal differences: path->len = number of verts */
/* NOW WITH BEVELCURVE!!! */
-
+
if (ob == NULL || ob->type != OB_CURVE) {
return;
}
if (ob->curve_cache->path) free_path(ob->curve_cache->path);
ob->curve_cache->path = NULL;
-
+
/* weak! can only use first curve */
bl = ob->curve_cache->bev.first;
if (bl == NULL || !bl->nr) {
@@ -506,18 +506,18 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
nu = nurbs->first;
ob->curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath");
-
+
/* if POLY: last vertice != first vertice */
cycl = (bl->poly != -1);
-
+
tot = cycl ? bl->nr : bl->nr - 1;
-
+
path->len = tot + 1;
/* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */
if (path->len < nu->resolu * SEGMENTSU(nu)) {
path->len = nu->resolu * SEGMENTSU(nu);
}
-
+
dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist");
/* all lengths in *dist */
@@ -530,13 +530,13 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec);
else
sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec);
-
+
*fp = *(fp - 1) + len_v3(xyz);
bevp++;
}
-
+
path->totdist = *fp;
-
+
/* the path verts in path->data */
/* now also with TILT value */
pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata");
@@ -551,11 +551,11 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
maxdist = dist + tot;
fac = 1.0f / ((float)path->len - 1.0f);
fac = fac * path->totdist;
-
+
for (a = 0; a < path->len; a++) {
-
+
d = ((float)a) * fac;
-
+
/* we're looking for location (distance) 'd' in the array */
if (LIKELY(tot > 0)) {
while ((fp < maxdist) && (d >= *fp)) {
@@ -581,10 +581,10 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight;
interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2);
normalize_qt(pp->quat);
-
+
pp++;
}
-
+
MEM_freeN(dist);
}
@@ -628,7 +628,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
}
path = ob->curve_cache->path;
pp = path->data;
-
+
/* test for cyclic */
bl = ob->curve_cache->bev.first;
if (!bl) return 0;
@@ -639,7 +639,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
BLI_assert(cycl || ctime >= 0.0f);
ctime *= (path->len - 1);
-
+
s1 = (int)floor(ctime);
fac = (float)(s1 + 1) - ctime;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 96914c8d639..05cb10ab7a4 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -104,7 +104,7 @@ bool id_type_can_have_animdata(const short id_type)
case ID_GD:
case ID_CF:
return true;
-
+
/* no AnimData */
default:
return false;
@@ -120,13 +120,13 @@ bool id_can_have_animdata(const ID *id)
return id_type_can_have_animdata(GS(id->name));
}
-/* Get AnimData from the given ID-block. In order for this to work, we assume that
+/* Get AnimData from the given ID-block. In order for this to work, we assume that
* the AnimData pointer is stored immediately after the given ID-block in the struct,
* as per IdAdtTemplate.
*/
AnimData *BKE_animdata_from_id(ID *id)
{
- /* only some ID-blocks have this info for now, so we cast the
+ /* only some ID-blocks have this info for now, so we cast the
* types that do to be of type IdAdtTemplate, and extract the
* AnimData that way
*/
@@ -138,33 +138,33 @@ AnimData *BKE_animdata_from_id(ID *id)
return NULL;
}
-/* Add AnimData to the given ID-block. In order for this to work, we assume that
+/* Add AnimData to the given ID-block. In order for this to work, we assume that
* the AnimData pointer is stored immediately after the given ID-block in the struct,
* as per IdAdtTemplate. Also note that
*/
AnimData *BKE_animdata_add_id(ID *id)
{
- /* Only some ID-blocks have this info for now, so we cast the
+ /* Only some ID-blocks have this info for now, so we cast the
* types that do to be of type IdAdtTemplate, and add the AnimData
* to it using the template
*/
if (id_can_have_animdata(id)) {
IdAdtTemplate *iat = (IdAdtTemplate *)id;
-
+
/* check if there's already AnimData, in which case, don't add */
if (iat->adt == NULL) {
AnimData *adt;
-
+
/* add animdata */
adt = iat->adt = MEM_callocN(sizeof(AnimData), "AnimData");
-
+
/* set default settings */
adt->act_influence = 1.0f;
}
-
+
return iat->adt;
}
- else
+ else
return NULL;
}
@@ -175,14 +175,14 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
{
AnimData *adt = BKE_animdata_from_id(id);
bool ok = false;
-
+
/* animdata validity check */
if (adt == NULL) {
BKE_report(reports, RPT_WARNING, "No AnimData to set action on");
return ok;
}
-
- /* active action is only editable when it is not a tweaking strip
+
+ /* active action is only editable when it is not a tweaking strip
* see rna_AnimData_action_editable() in rna_animation.c
*/
if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) {
@@ -190,11 +190,11 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
BKE_report(reports, RPT_ERROR, "Cannot change action, as it is still being edited in NLA");
return ok;
}
-
+
/* manage usercount for current action */
if (adt->action)
id_us_min((ID *)adt->action);
-
+
/* assume that AnimData's action can in fact be edited... */
if (act) {
/* action must have same type as owner */
@@ -217,7 +217,7 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
adt->action = NULL;
ok = true;
}
-
+
return ok;
}
@@ -226,13 +226,13 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
/* Free AnimData used by the nominated ID-block, and clear ID-block's AnimData pointer */
void BKE_animdata_free(ID *id, const bool do_id_user)
{
- /* Only some ID-blocks have this info for now, so we cast the
+ /* Only some ID-blocks have this info for now, so we cast the
* types that do to be of type IdAdtTemplate
*/
if (id_can_have_animdata(id)) {
IdAdtTemplate *iat = (IdAdtTemplate *)id;
AnimData *adt = iat->adt;
-
+
/* check if there's any AnimData to start with */
if (adt) {
if (do_id_user) {
@@ -243,16 +243,16 @@ void BKE_animdata_free(ID *id, const bool do_id_user)
if (adt->tmpact)
id_us_min(&adt->tmpact->id);
}
-
+
/* free nla data */
BKE_nla_tracks_free(&adt->nla_tracks);
-
+
/* free drivers - stored as a list of F-Curves */
free_fcurves(&adt->drivers);
-
+
/* free overrides */
/* TODO... */
-
+
/* free animdata now */
MEM_freeN(adt);
iat->adt = NULL;
@@ -266,12 +266,12 @@ void BKE_animdata_free(ID *id, const bool do_id_user)
AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const bool do_action)
{
AnimData *dadt;
-
+
/* sanity check before duplicating struct */
if (adt == NULL)
return NULL;
dadt = MEM_dupallocN(adt);
-
+
/* make a copy of action - at worst, user has to delete copies... */
if (do_action) {
BLI_assert(bmain != NULL);
@@ -285,13 +285,13 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const bool do_action)
/* duplicate NLA data */
BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks);
-
+
/* duplicate drivers (F-Curves) */
copy_fcurves(&dadt->drivers, &adt->drivers);
-
+
/* don't copy overrides */
BLI_listbase_clear(&dadt->overrides);
-
+
/* return */
return dadt;
}
@@ -338,17 +338,17 @@ void BKE_animdata_merge_copy(
{
AnimData *src = BKE_animdata_from_id(src_id);
AnimData *dst = BKE_animdata_from_id(dst_id);
-
+
/* sanity checks */
if (ELEM(NULL, dst, src))
return;
-
+
// TODO: we must unset all "tweakmode" flags
if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) {
printf("ERROR: Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption\n");
return;
}
-
+
/* handle actions... */
if (action_mode == ADT_MERGECOPY_SRC_COPY) {
/* make a copy of the actions */
@@ -359,35 +359,35 @@ void BKE_animdata_merge_copy(
/* make a reference to it */
dst->action = src->action;
id_us_plus((ID *)dst->action);
-
+
dst->tmpact = src->tmpact;
id_us_plus((ID *)dst->tmpact);
}
-
+
/* duplicate NLA data */
if (src->nla_tracks.first) {
ListBase tracks = {NULL, NULL};
-
+
BKE_nla_tracks_copy(bmain, &tracks, &src->nla_tracks);
BLI_movelisttolist(&dst->nla_tracks, &tracks);
}
-
+
/* duplicate drivers (F-Curves) */
if (src->drivers.first) {
ListBase drivers = {NULL, NULL};
-
+
copy_fcurves(&drivers, &src->drivers);
-
+
/* Fix up all driver targets using the old target id
* - This assumes that the src ID is being merged into the dst ID
*/
if (fix_drivers) {
FCurve *fcu;
-
+
for (fcu = drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
-
+
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
DRIVER_TARGETS_USED_LOOPER(dvar)
{
@@ -399,7 +399,7 @@ void BKE_animdata_merge_copy(
}
}
}
-
+
BLI_movelisttolist(&dst->drivers, &drivers);
}
}
@@ -419,7 +419,7 @@ static bool animpath_matches_basepath(const char path[], const char basepath[])
return (path && basepath) && STRPREFIX(path, basepath);
}
-/* Move F-Curves in src action to dst action, setting up all the necessary groups
+/* Move F-Curves in src action to dst action, setting up all the necessary groups
* for this to happen, but only if the F-Curves being moved have the appropriate
* "base path".
* - This is used when data moves from one datablock to another, causing the
@@ -428,7 +428,7 @@ static bool animpath_matches_basepath(const char path[], const char basepath[])
void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const char basepath[])
{
FCurve *fcu, *fcn = NULL;
-
+
/* sanity checks */
if (ELEM(NULL, srcAct, dstAct, basepath)) {
if (G.debug & G_DEBUG) {
@@ -437,56 +437,56 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha
}
return;
}
-
- /* clear 'temp' flags on all groups in src, as we'll be needing them later
+
+ /* clear 'temp' flags on all groups in src, as we'll be needing them later
* to identify groups that we've managed to empty out here
*/
action_groups_clear_tempflags(srcAct);
-
+
/* iterate over all src F-Curves, moving over the ones that need to be moved */
for (fcu = srcAct->curves.first; fcu; fcu = fcn) {
/* store next pointer in case we move stuff */
fcn = fcu->next;
-
+
/* should F-Curve be moved over?
* - we only need the start of the path to match basepath
*/
if (animpath_matches_basepath(fcu->rna_path, basepath)) {
bActionGroup *agrp = NULL;
-
+
/* if grouped... */
if (fcu->grp) {
/* make sure there will be a matching group on the other side for the migrants */
agrp = BKE_action_group_find_name(dstAct, fcu->grp->name);
-
+
if (agrp == NULL) {
/* add a new one with a similar name (usually will be the same though) */
agrp = action_groups_add_new(dstAct, fcu->grp->name);
}
-
+
/* old groups should be tagged with 'temp' flags so they can be removed later
* if we remove everything from them
*/
fcu->grp->flag |= AGRP_TEMP;
}
-
+
/* perform the migration now */
action_groups_remove_channel(srcAct, fcu);
-
+
if (agrp)
action_groups_add_channel(dstAct, agrp, fcu);
else
BLI_addtail(&dstAct->curves, fcu);
}
}
-
+
/* cleanup groups (if present) */
if (srcAct->groups.first) {
bActionGroup *agrp, *grp = NULL;
-
+
for (agrp = srcAct->groups.first; agrp; agrp = grp) {
grp = agrp->next;
-
+
/* only tagged groups need to be considered - clearing these tags or removing them */
if (agrp->flag & AGRP_TEMP) {
/* if group is empty and tagged, then we can remove as this operation
@@ -510,24 +510,24 @@ void BKE_animdata_separate_by_basepath(
{
AnimData *srcAdt = NULL, *dstAdt = NULL;
LinkData *ld;
-
+
/* sanity checks */
if (ELEM(NULL, srcID, dstID)) {
if (G.debug & G_DEBUG)
printf("ERROR: no source or destination ID to separate AnimData with\n");
return;
}
-
+
/* get animdata from src, and create for destination (if needed) */
srcAdt = BKE_animdata_from_id(srcID);
dstAdt = BKE_animdata_add_id(dstID);
-
+
if (ELEM(NULL, srcAdt, dstAdt)) {
if (G.debug & G_DEBUG)
printf("ERROR: no AnimData for this pair of ID's\n");
return;
}
-
+
/* active action */
if (srcAdt->action) {
/* set up an action if necessary, and name it in a similar way so that it can be easily found again */
@@ -537,38 +537,38 @@ void BKE_animdata_separate_by_basepath(
else if (dstAdt->action == srcAdt->action) {
printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n",
srcID->name, dstID->name, srcAdt->action->id.name);
-
+
/* TODO: review this... */
id_us_min(&dstAdt->action->id);
dstAdt->action = BKE_action_add(bmain, dstAdt->action->id.name + 2);
}
-
+
/* loop over base paths, trying to fix for each one... */
for (ld = basepaths->first; ld; ld = ld->next) {
const char *basepath = (const char *)ld->data;
action_move_fcurves_by_basepath(srcAdt->action, dstAdt->action, basepath);
}
}
-
+
/* drivers */
if (srcAdt->drivers.first) {
FCurve *fcu, *fcn = NULL;
-
+
/* check each driver against all the base paths to see if any should go */
for (fcu = srcAdt->drivers.first; fcu; fcu = fcn) {
fcn = fcu->next;
-
+
/* try each basepath in turn, but stop on the first one which works */
for (ld = basepaths->first; ld; ld = ld->next) {
const char *basepath = (const char *)ld->data;
-
+
if (animpath_matches_basepath(fcu->rna_path, basepath)) {
/* just need to change lists */
BLI_remlink(&srcAdt->drivers, fcu);
BLI_addtail(&dstAdt->drivers, fcu);
-
+
/* TODO: add depsgraph flushing calls? */
-
+
/* can stop now, as moved already */
break;
}
@@ -654,15 +654,15 @@ static bool check_rna_path_is_valid(ID *owner_id, const char *path)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
-
+
/* make initial RNA pointer to start resolving from */
RNA_id_pointer_create(owner_id, &id_ptr);
-
+
/* try to resolve */
- return RNA_path_resolve_property(&id_ptr, path, &ptr, &prop);
+ return RNA_path_resolve_property(&id_ptr, path, &ptr, &prop);
}
-/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate
+/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate
* NOTE: we assume that oldName and newName have [" "] padding around them
*/
static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, bool verify_paths)
@@ -671,7 +671,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
char *oldNamePtr = strstr(oldpath, oldName);
int prefixLen = strlen(prefix);
int oldNameLen = strlen(oldName);
-
+
/* only start fixing the path if the prefix and oldName feature in the path,
* and prefix occurs immediately before oldName
*/
@@ -686,20 +686,20 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
if (prefixPtr > oldpath) {
BLI_dynstr_nappend(ds, oldpath, prefixPtr - oldpath);
}
-
+
/* add the prefix */
BLI_dynstr_append(ds, prefix);
-
+
/* add the new name (complete with brackets) */
BLI_dynstr_append(ds, newName);
-
+
/* add the postfix */
BLI_dynstr_append(ds, postfixPtr);
-
+
/* create new path, and cleanup old data */
newPath = BLI_dynstr_get_cstring(ds);
BLI_dynstr_free(ds);
-
+
/* check if the new path will solve our problems */
/* TODO: will need to check whether this step really helps in practice */
if (!verify_paths || check_rna_path_is_valid(owner_id, newPath)) {
@@ -713,31 +713,31 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
}
}
}
-
+
/* the old path doesn't need to be changed */
return oldpath;
}
/* Check RNA-Paths for a list of F-Curves */
-static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
FCurve *fcu;
-
+
/* we need to check every curve... */
for (fcu = curves->first; fcu; fcu = fcu->next) {
if (fcu->rna_path) {
const char *old_path = fcu->rna_path;
-
+
/* firstly, handle the F-Curve's own path */
fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
-
+
/* if path changed and the F-Curve is grouped, check if its group also needs renaming
* (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename)
*/
if (fcu->rna_path != old_path) {
bActionGroup *agrp = fcu->grp;
-
+
if ((agrp) && STREQ(oldName, agrp->name)) {
BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
}
@@ -751,27 +751,27 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
FCurve *fcu;
-
+
/* we need to check every curve - drivers are F-Curves too! */
for (fcu = curves->first; fcu; fcu = fcu->next) {
/* firstly, handle the F-Curve's own path */
if (fcu->rna_path)
fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
-
+
/* driver? */
if (fcu->driver) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
-
+
/* driver variables */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
/* only change the used targets, since the others will need fixing manually anyway */
- DRIVER_TARGETS_USED_LOOPER(dvar)
+ DRIVER_TARGETS_USED_LOOPER(dvar)
{
/* rename RNA path */
if (dtar->rna_path && dtar->id)
dtar->rna_path = rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths);
-
+
/* also fix the bone-name (if applicable) */
if (strstr(prefix, "bones")) {
if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object *)(dtar->id))->data == ref_id)) &&
@@ -788,18 +788,18 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
}
/* Fix all RNA-Paths for Actions linked to NLA Strips */
-static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
const char *oldKey, const char *newKey, ListBase *strips, bool verify_paths)
{
NlaStrip *strip;
-
+
/* recursively check strips, fixing only actions... */
for (strip = strips->first; strip; strip = strip->next) {
/* fix strip's action */
if (strip->act)
fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths);
/* ignore own F-Curves, since those are local... */
-
+
/* check sub-strips (if metas) */
nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths);
}
@@ -820,13 +820,13 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char *old_path, const char *
{
char *oldN, *newN;
char *result;
-
+
/* if no action, no need to proceed */
if (ELEM(NULL, owner_id, old_path)) {
if (G.debug & G_DEBUG) printf("%s: early abort\n", __func__);
return old_path;
}
-
+
/* Name sanitation logic - copied from BKE_animdata_fix_paths_rename() */
if ((oldName != NULL) && (newName != NULL)) {
/* pad the names with [" "] so that only exact matches are made */
@@ -844,21 +844,21 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char *old_path, const char *
oldN = BLI_sprintfN("[%d]", oldSubscript);
newN = BLI_sprintfN("[%d]", newSubscript);
}
-
+
/* fix given path */
if (G.debug & G_DEBUG) printf("%s | %s | oldpath = %p ", oldN, newN, old_path);
result = rna_path_rename_fix(owner_id, prefix, oldN, newN, old_path, verify_paths);
if (G.debug & G_DEBUG) printf("path rename result = %p\n", result);
-
+
/* free the temp names */
MEM_freeN(oldN);
MEM_freeN(newN);
-
+
/* return the resulting path - may be the same path again if nothing changed */
return result;
}
-/* Fix all RNA_Paths in the given Action, relative to the given ID block
+/* Fix all RNA_Paths in the given Action, relative to the given ID block
*
* This is just an external wrapper for the F-Curve fixing function,
* with input validity checks on top of the basic method.
@@ -870,11 +870,11 @@ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix,
const char *newName, int oldSubscript, int newSubscript, bool verify_paths)
{
char *oldN, *newN;
-
+
/* if no action, no need to proceed */
if (ELEM(NULL, owner_id, act))
return;
-
+
/* Name sanitation logic - copied from BKE_animdata_fix_paths_rename() */
if ((oldName != NULL) && (newName != NULL)) {
/* pad the names with [" "] so that only exact matches are made */
@@ -892,10 +892,10 @@ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix,
oldN = BLI_sprintfN("[%d]", oldSubscript);
newN = BLI_sprintfN("[%d]", newSubscript);
}
-
+
/* fix paths in action */
fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &act->curves, verify_paths);
-
+
/* free the temp names */
MEM_freeN(oldN);
MEM_freeN(newN);
@@ -910,11 +910,11 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
{
NlaTrack *nlt;
char *oldN, *newN;
-
+
/* if no AnimData, no need to proceed */
if (ELEM(NULL, owner_id, adt))
return;
-
+
/* Name sanitation logic - shared with BKE_action_fix_paths_rename() */
if ((oldName != NULL) && (newName != NULL)) {
/* pad the names with [" "] so that only exact matches are made */
@@ -932,16 +932,16 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
oldN = BLI_sprintfN("[%d]", oldSubscript);
newN = BLI_sprintfN("[%d]", newSubscript);
}
-
+
/* Active action and temp action */
if (adt->action)
fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->action->curves, verify_paths);
if (adt->tmpact)
fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->tmpact->curves, verify_paths);
-
+
/* Drivers - Drivers are really F-Curves */
drivers_path_rename_fix(owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
-
+
/* NLA Data - Animation Data for Strips */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next)
nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths);
@@ -1031,7 +1031,7 @@ typedef struct AllFCurvesCbWrapper {
static void fcurves_apply_cb(ID *id, ListBase *fcurves, ID_FCurve_Edit_Callback func, void *user_data)
{
FCurve *fcu;
-
+
for (fcu = fcurves->first; fcu; fcu = fcu->next) {
func(id, fcu, user_data);
}
@@ -1041,13 +1041,13 @@ static void fcurves_apply_cb(ID *id, ListBase *fcurves, ID_FCurve_Edit_Callback
static void nlastrips_apply_all_curves_cb(ID *id, ListBase *strips, AllFCurvesCbWrapper *wrapper)
{
NlaStrip *strip;
-
+
for (strip = strips->first; strip; strip = strip->next) {
/* fix strip's action */
if (strip->act) {
fcurves_apply_cb(id, &strip->act->curves, wrapper->func, wrapper->user_data);
}
-
+
/* check sub-strips (if metas) */
nlastrips_apply_all_curves_cb(id, &strip->strips, wrapper);
}
@@ -1058,18 +1058,18 @@ static void adt_apply_all_fcurves_cb(ID *id, AnimData *adt, void *wrapper_data)
{
AllFCurvesCbWrapper *wrapper = wrapper_data;
NlaTrack *nlt;
-
+
if (adt->action) {
fcurves_apply_cb(id, &adt->action->curves, wrapper->func, wrapper->user_data);
}
-
+
if (adt->tmpact) {
fcurves_apply_cb(id, &adt->tmpact->curves, wrapper->func, wrapper->user_data);
}
-
+
/* free drivers - stored as a list of F-Curves */
fcurves_apply_cb(id, &adt->drivers, wrapper->func, wrapper->user_data);
-
+
/* NLA Data - Animation Data for Strips */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
nlastrips_apply_all_curves_cb(id, &nlt->strips, wrapper);
@@ -1081,7 +1081,7 @@ void BKE_fcurves_main_cb(Main *bmain, ID_FCurve_Edit_Callback func, void *user_d
{
/* Wrap F-Curve operation stuff to pass to the general AnimData-level func */
AllFCurvesCbWrapper wrapper = {func, user_data};
-
+
/* Use the AnimData-based function so that we don't have to reimplement all that stuff */
BKE_animdata_main_cb(bmain, adt_apply_all_fcurves_cb, &wrapper);
}
@@ -1100,7 +1100,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
AnimData *adt = BKE_animdata_from_id(id); \
if (adt) func(id, adt, user_data); \
} (void)0
-
+
/* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */
#define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \
for (id = first; id; id = id->next) { \
@@ -1112,40 +1112,40 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
} \
if (adt) func(id, adt, user_data); \
} (void)0
-
+
/* nodes */
ANIMDATA_IDS_CB(bmain->nodetree.first);
-
+
/* textures */
ANIMDATA_NODETREE_IDS_CB(bmain->tex.first, Tex);
-
+
/* lamps */
ANIMDATA_NODETREE_IDS_CB(bmain->lamp.first, Lamp);
-
+
/* materials */
ANIMDATA_NODETREE_IDS_CB(bmain->mat.first, Material);
-
+
/* cameras */
ANIMDATA_IDS_CB(bmain->camera.first);
-
+
/* shapekeys */
ANIMDATA_IDS_CB(bmain->key.first);
-
+
/* metaballs */
ANIMDATA_IDS_CB(bmain->mball.first);
-
+
/* curves */
ANIMDATA_IDS_CB(bmain->curve.first);
-
+
/* armatures */
ANIMDATA_IDS_CB(bmain->armature.first);
-
+
/* lattices */
ANIMDATA_IDS_CB(bmain->latt.first);
-
+
/* meshes */
ANIMDATA_IDS_CB(bmain->mesh.first);
-
+
/* particles */
ANIMDATA_IDS_CB(bmain->particle.first);
@@ -1160,7 +1160,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
/* masks */
ANIMDATA_IDS_CB(bmain->mask.first);
-
+
/* worlds */
ANIMDATA_NODETREE_IDS_CB(bmain->world.first, World);
@@ -1169,7 +1169,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
/* line styles */
ANIMDATA_IDS_CB(bmain->linestyle.first);
-
+
/* grease pencil */
ANIMDATA_IDS_CB(bmain->gpencil.first);
@@ -1186,9 +1186,9 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
{
Main *bmain = G.main; /* XXX UGLY! */
ID *id;
-
- /* macro for less typing
- * - whether animdata exists is checked for by the main renaming callback, though taking
+
+ /* macro for less typing
+ * - whether animdata exists is checked for by the main renaming callback, though taking
* this outside of the function may make things slightly faster?
*/
#define RENAMEFIX_ANIM_IDS(first) \
@@ -1196,7 +1196,7 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
AnimData *adt = BKE_animdata_from_id(id); \
BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \
} (void)0
-
+
/* another version of this macro for nodetrees */
#define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \
for (id = first; id; id = id->next) { \
@@ -1208,40 +1208,40 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
} \
BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \
} (void)0
-
+
/* nodes */
RENAMEFIX_ANIM_IDS(bmain->nodetree.first);
-
+
/* textures */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->tex.first, Tex);
-
+
/* lamps */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->lamp.first, Lamp);
-
+
/* materials */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->mat.first, Material);
-
+
/* cameras */
RENAMEFIX_ANIM_IDS(bmain->camera.first);
-
+
/* shapekeys */
RENAMEFIX_ANIM_IDS(bmain->key.first);
-
+
/* metaballs */
RENAMEFIX_ANIM_IDS(bmain->mball.first);
-
+
/* curves */
RENAMEFIX_ANIM_IDS(bmain->curve.first);
-
+
/* armatures */
RENAMEFIX_ANIM_IDS(bmain->armature.first);
-
+
/* lattices */
RENAMEFIX_ANIM_IDS(bmain->latt.first);
-
+
/* meshes */
RENAMEFIX_ANIM_IDS(bmain->mesh.first);
-
+
/* particles */
RENAMEFIX_ANIM_IDS(bmain->particle.first);
@@ -1256,24 +1256,24 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
/* masks */
RENAMEFIX_ANIM_IDS(bmain->mask.first);
-
+
/* worlds */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->world.first, World);
-
+
/* linestyles */
RENAMEFIX_ANIM_IDS(bmain->linestyle.first);
-
+
/* grease pencil */
RENAMEFIX_ANIM_IDS(bmain->gpencil.first);
/* cache files */
RENAMEFIX_ANIM_IDS(bmain->cachefiles.first);
-
+
/* scenes */
RENAMEFIX_ANIM_NODETREE_IDS(bmain->scene.first, Scene);
}
-/* *********************************** */
+/* *********************************** */
/* KeyingSet API */
/* Finding Tools --------------------------- */
@@ -1283,50 +1283,50 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
KS_Path *BKE_keyingset_find_path(KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode))
{
KS_Path *ksp;
-
+
/* sanity checks */
if (ELEM(NULL, ks, rna_path, id))
return NULL;
-
- /* loop over paths in the current KeyingSet, finding the first one where all settings match
+
+ /* loop over paths in the current KeyingSet, finding the first one where all settings match
* (i.e. the first one where none of the checks fail and equal 0)
*/
for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
short eq_id = 1, eq_path = 1, eq_index = 1, eq_group = 1;
-
+
/* id */
if (id != ksp->id)
eq_id = 0;
-
+
/* path */
if ((ksp->rna_path == NULL) || !STREQ(rna_path, ksp->rna_path))
eq_path = 0;
-
+
/* index - need to compare whole-array setting too... */
if (ksp->array_index != array_index)
eq_index = 0;
-
+
/* group */
if (group_name) {
/* FIXME: these checks need to be coded... for now, it's not too important though */
}
-
+
/* if all aspects are ok, return */
if (eq_id && eq_path && eq_index && eq_group)
return ksp;
}
-
+
/* none found */
return NULL;
}
-
+
/* Defining Tools --------------------------- */
/* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
{
KeyingSet *ks;
-
+
/* allocate new KeyingSet */
ks = MEM_callocN(sizeof(KeyingSet), "KeyingSet");
@@ -1336,16 +1336,16 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
ks->flag = flag;
ks->keyingflag = keyingflag;
ks->keyingoverride = keyingflag; /* NOTE: assume that if one is set one way, the other should be too, so that it'll work */
-
+
/* add KeyingSet to list */
BLI_addtail(list, ks);
-
+
/* Make sure KeyingSet has a unique idname */
BLI_uniquename(list, ks, DATA_("KeyingSet"), '.', offsetof(KeyingSet, idname), sizeof(ks->idname));
-
+
/* Make sure KeyingSet has a unique label (this helps with identification) */
BLI_uniquename(list, ks, DATA_("Keying Set"), '.', offsetof(KeyingSet, name), sizeof(ks->name));
-
+
/* return new KeyingSet for further editing */
return ks;
}
@@ -1356,55 +1356,55 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
KS_Path *BKE_keyingset_add_path(KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
{
KS_Path *ksp;
-
+
/* sanity checks */
if (ELEM(NULL, ks, rna_path)) {
printf("ERROR: no Keying Set and/or RNA Path to add path with\n");
return NULL;
}
-
+
/* ID is required for all types of KeyingSets */
if (id == NULL) {
printf("ERROR: No ID provided for Keying Set Path\n");
return NULL;
}
-
+
/* don't add if there is already a matching KS_Path in the KeyingSet */
if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) {
if (G.debug & G_DEBUG)
printf("ERROR: destination already exists in Keying Set\n");
return NULL;
}
-
+
/* allocate a new KeyingSet Path */
ksp = MEM_callocN(sizeof(KS_Path), "KeyingSet Path");
-
+
/* just store absolute info */
ksp->id = id;
if (group_name)
BLI_strncpy(ksp->group, group_name, sizeof(ksp->group));
else
ksp->group[0] = '\0';
-
+
/* store additional info for relative paths (just in case user makes the set relative) */
if (id)
ksp->idtype = GS(id->name);
-
+
/* just copy path info */
/* TODO: should array index be checked too? */
ksp->rna_path = BLI_strdup(rna_path);
ksp->array_index = array_index;
-
+
/* store flags */
ksp->flag = flag;
ksp->groupmode = groupmode;
-
+
/* add KeyingSet path to KeyingSet */
BLI_addtail(&ks->paths, ksp);
-
+
/* return this path */
return ksp;
-}
+}
/* Free the given Keying Set path */
void BKE_keyingset_free_path(KeyingSet *ks, KS_Path *ksp)
@@ -1426,12 +1426,12 @@ void BKE_keyingsets_copy(ListBase *newlist, const ListBase *list)
{
KeyingSet *ksn;
KS_Path *kspn;
-
+
BLI_duplicatelist(newlist, list);
for (ksn = newlist->first; ksn; ksn = ksn->next) {
BLI_duplicatelist(&ksn->paths, &ksn->paths);
-
+
for (kspn = ksn->paths.first; kspn; kspn = kspn->next)
kspn->rna_path = MEM_dupallocN(kspn->rna_path);
}
@@ -1443,11 +1443,11 @@ void BKE_keyingsets_copy(ListBase *newlist, const ListBase *list)
void BKE_keyingset_free(KeyingSet *ks)
{
KS_Path *ksp, *kspn;
-
+
/* sanity check */
if (ks == NULL)
return;
-
+
/* free each path as we go to avoid looping twice */
for (ksp = ks->paths.first; ksp; ksp = kspn) {
kspn = ksp->next;
@@ -1459,12 +1459,12 @@ void BKE_keyingset_free(KeyingSet *ks)
void BKE_keyingsets_free(ListBase *list)
{
KeyingSet *ks, *ksn;
-
+
/* sanity check */
if (list == NULL)
return;
-
- /* loop over KeyingSets freeing them
+
+ /* loop over KeyingSets freeing them
* - BKE_keyingset_free() doesn't free the set itself, but it frees its sub-data
*/
for (ks = list->first; ks; ks = ksn) {
@@ -1477,7 +1477,7 @@ void BKE_keyingsets_free(ListBase *list)
/* ***************************************** */
/* Evaluation Data-Setting Backend */
-/* Retrieve string to act as RNA-path, adjusted using mapping-table if provided
+/* Retrieve string to act as RNA-path, adjusted using mapping-table if provided
* It returns whether the string needs to be freed (i.e. if it was a temp remapped one)
* // FIXME: maybe it would be faster if we didn't have to alloc/free strings like this all the time, but for now it's safer
*
@@ -1564,7 +1564,7 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
PropertyRNA *prop = anim_rna->prop;
PointerRNA *ptr = &anim_rna->ptr;
int array_index = anim_rna->prop_index;
-
+
/* caller must ensure this is animatable */
BLI_assert(RNA_property_animateable(ptr, prop) || ptr->id.data == NULL);
@@ -1697,13 +1697,13 @@ bool BKE_animsys_execute_fcurve(PointerRNA *ptr, AnimMapper *remap, FCurve *fcu,
return ok;
}
-/* Evaluate all the F-Curves in the given list
+/* Evaluate all the F-Curves in the given list
* This performs a set of standard checks. If extra checks are required, separate code should be used
*/
static void animsys_evaluate_fcurves(PointerRNA *ptr, ListBase *list, AnimMapper *remap, float ctime)
{
FCurve *fcu;
-
+
/* calculate then execute each curve */
for (fcu = list->first; fcu; fcu = fcu->next) {
/* check if this F-Curve doesn't belong to a muted group */
@@ -1727,14 +1727,14 @@ static void animsys_evaluate_fcurves(PointerRNA *ptr, ListBase *list, AnimMapper
static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime)
{
FCurve *fcu;
-
+
/* drivers are stored as F-Curves, but we cannot use the standard code, as we need to check if
* the depsgraph requested that this driver be evaluated...
*/
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
bool ok = false;
-
+
/* check if this driver's curve should be skipped */
if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
/* check if driver itself is tagged for recalculation */
@@ -1749,13 +1749,13 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
const float curval = calculate_fcurve(&anim_rna, fcu, ctime);
ok = animsys_write_rna_setting(&anim_rna, curval);
}
-
+
/* clear recalc flag */
driver->flag &= ~DRIVER_FLAG_RECALC;
-
+
/* set error-flag if evaluation failed */
if (ok == 0)
- driver->flag |= DRIVER_FLAG_INVALID;
+ driver->flag |= DRIVER_FLAG_INVALID;
}
}
}
@@ -1771,13 +1771,13 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
static void action_idcode_patch_check(ID *id, bAction *act)
{
int idcode = 0;
-
+
/* just in case */
if (ELEM(NULL, id, act))
return;
else
idcode = GS(id->name);
-
+
/* the actual checks... hopefully not too much of a performance hit in the long run... */
if (act->idroot == 0) {
/* use the current root if not set already (i.e. newly created actions and actions from 2.50-2.57 builds)
@@ -1801,17 +1801,17 @@ static void action_idcode_patch_check(ID *id, bAction *act)
void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *agrp, AnimMapper *remap, float ctime)
{
FCurve *fcu;
-
+
/* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */
if (ELEM(NULL, act, agrp)) return;
if ((remap) && (remap->target != act)) remap = NULL;
-
+
action_idcode_patch_check(ptr->id.data, act);
-
+
/* if group is muted, don't evaluated any of the F-Curve */
if (agrp->flag & AGRP_MUTED)
return;
-
+
/* calculate then execute each curve */
for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcu->next) {
/* check if this curve should be skipped */
@@ -1831,9 +1831,9 @@ void animsys_evaluate_action(PointerRNA *ptr, bAction *act, AnimMapper *remap, f
/* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */
if (act == NULL) return;
if ((remap) && (remap->target != act)) remap = NULL;
-
+
action_idcode_patch_check(ptr->id.data, act);
-
+
/* calculate then execute each curve */
animsys_evaluate_fcurves(ptr, &act->curves, remap, ctime);
}
@@ -1847,7 +1847,7 @@ static float nlastrip_get_influence(NlaStrip *strip, float cframe)
/* sanity checks - normalize the blendin/out values? */
strip->blendin = fabsf(strip->blendin);
strip->blendout = fabsf(strip->blendout);
-
+
/* result depends on where frame is in respect to blendin/out values */
if (IS_EQF(strip->blendin, 0.0f) == false && (cframe <= (strip->start + strip->blendin))) {
/* there is some blend-in */
@@ -1869,14 +1869,14 @@ static void nlastrip_evaluate_controls(NlaStrip *strip, float ctime)
/* now strip's evaluate F-Curves for these settings (if applicable) */
if (strip->fcurves.first) {
PointerRNA strip_ptr;
-
+
/* create RNA-pointer needed to set values */
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
-
+
/* execute these settings as per normal */
animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime);
}
-
+
/* analytically generate values for influence and time (if applicable)
* - we do this after the F-Curves have been evaluated to override the effects of those
* in case the override has been turned off.
@@ -1901,7 +1901,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
NlaStrip *strip, *estrip = NULL;
NlaEvalStrip *nes;
short side = 0;
-
+
/* loop over strips, checking if they fall within the range */
for (strip = strips->first; strip; strip = strip->next) {
/* check if current time occurs within this strip */
@@ -1911,53 +1911,53 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
side = NES_TIME_WITHIN;
break;
}
-
+
/* if time occurred before current strip... */
if (ctime < strip->start) {
if (strip == strips->first) {
/* before first strip - only try to use it if it extends backwards in time too */
if (strip->extendmode == NLASTRIP_EXTEND_HOLD)
estrip = strip;
-
+
/* side is 'before' regardless of whether there's a useful strip */
side = NES_TIME_BEFORE;
}
else {
- /* before next strip - previous strip has ended, but next hasn't begun,
+ /* before next strip - previous strip has ended, but next hasn't begun,
* so blending mode depends on whether strip is being held or not...
* - only occurs when no transition strip added, otherwise the transition would have
* been picked up above...
*/
strip = strip->prev;
-
+
if (strip->extendmode != NLASTRIP_EXTEND_NOTHING)
estrip = strip;
side = NES_TIME_AFTER;
}
break;
}
-
+
/* if time occurred after current strip... */
if (ctime > strip->end) {
/* only if this is the last strip should we do anything, and only if that is being held */
if (strip == strips->last) {
if (strip->extendmode != NLASTRIP_EXTEND_NOTHING)
estrip = strip;
-
+
side = NES_TIME_AFTER;
break;
}
-
+
/* otherwise, skip... as the 'before' case will catch it more elegantly! */
}
}
-
+
/* check if a valid strip was found
* - must not be muted (i.e. will have contribution
*/
- if ((estrip == NULL) || (estrip->flag & NLASTRIP_FLAG_MUTED))
+ if ((estrip == NULL) || (estrip->flag & NLASTRIP_FLAG_MUTED))
return NULL;
-
+
/* if ctime was not within the boundaries of the strip, clamp! */
switch (side) {
case NES_TIME_BEFORE: /* extend first frame only */
@@ -1967,8 +1967,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
ctime = estrip->end;
break;
}
-
- /* evaluate strip's evaluation controls
+
+ /* evaluate strip's evaluation controls
* - skip if no influence (i.e. same effect as muting the strip)
* - negative influence is not supported yet... how would that be defined?
*/
@@ -1976,12 +1976,12 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
nlastrip_evaluate_controls(estrip, ctime);
if (estrip->influence <= 0.0f)
return NULL;
-
+
/* check if strip has valid data to evaluate,
* and/or perform any additional type-specific actions
*/
switch (estrip->type) {
- case NLASTRIP_TYPE_CLIP:
+ case NLASTRIP_TYPE_CLIP:
/* clip must have some action to evaluate */
if (estrip->act == NULL)
return NULL;
@@ -1990,51 +1990,51 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
/* there must be strips to transition from and to (i.e. prev and next required) */
if (ELEM(NULL, estrip->prev, estrip->next))
return NULL;
-
+
/* evaluate controls for the relevant extents of the bordering strips... */
nlastrip_evaluate_controls(estrip->prev, estrip->start);
nlastrip_evaluate_controls(estrip->next, estrip->end);
break;
}
-
+
/* add to list of strips we need to evaluate */
nes = MEM_callocN(sizeof(NlaEvalStrip), "NlaEvalStrip");
-
+
nes->strip = estrip;
nes->strip_mode = side;
nes->track_index = index;
nes->strip_time = estrip->strip_time;
-
+
if (list)
BLI_addtail(list, nes);
-
+
return nes;
}
/* ---------------------- */
-/* find an NlaEvalChannel that matches the given criteria
+/* find an NlaEvalChannel that matches the given criteria
* - ptr and prop are the RNA data to find a match for
*/
static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, PointerRNA *ptr, PropertyRNA *prop, int array_index)
{
NlaEvalChannel *nec;
-
+
/* sanity check */
if (channels == NULL)
return NULL;
-
+
/* loop through existing channels, checking for a channel which affects the same property */
for (nec = channels->first; nec; nec = nec->next) {
/* - comparing the PointerRNA's is done by comparing the pointers
* to the actual struct the property resides in, since that all the
- * other data stored in PointerRNA cannot allow us to definitively
- * identify the data
+ * other data stored in PointerRNA cannot allow us to definitively
+ * identify the data
*/
if ((nec->ptr.data == ptr->data) && (nec->prop == prop) && (nec->index == array_index))
return nec;
}
-
+
/* not found */
return NULL;
}
@@ -2045,9 +2045,9 @@ static void nlaevalchan_value_init(NlaEvalChannel *nec)
PointerRNA *ptr = &nec->ptr;
PropertyRNA *prop = nec->prop;
int index = nec->index;
-
- /* NOTE: while this doesn't work for all RNA properties as default values aren't in fact
- * set properly for most of them, at least the common ones (which also happen to get used
+
+ /* NOTE: while this doesn't work for all RNA properties as default values aren't in fact
+ * set properly for most of them, at least the common ones (which also happen to get used
* in NLA strips a lot, e.g. scale) are set correctly.
*/
switch (RNA_property_type(prop)) {
@@ -2086,15 +2086,15 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N
PointerRNA new_ptr;
char *path = NULL;
/* short free_path = 0; */
-
+
/* sanity checks */
if (channels == NULL)
return NULL;
-
+
/* get RNA pointer+property info from F-Curve for more convenient handling */
/* get path, remapped as appropriate to work in its new environment */
/* free_path = */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path);
-
+
/* a valid property must be available, and it must be animatable */
if (RNA_path_resolve_property(ptr, path, &new_ptr, &prop) == false) {
if (G.debug & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path\n");
@@ -2105,27 +2105,27 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N
if (G.debug & G_DEBUG) printf("NLA Strip Eval: Property not animatable\n");
return NULL;
}
-
+
/* try to find a match */
nec = nlaevalchan_find_match(channels, &new_ptr, prop, fcu->array_index);
-
+
/* allocate a new struct for this if none found */
if (nec == NULL) {
nec = MEM_callocN(sizeof(NlaEvalChannel), "NlaEvalChannel");
BLI_addtail(channels, nec);
-
+
/* store property links for writing to the property later */
nec->ptr = new_ptr;
nec->prop = prop;
nec->index = fcu->array_index;
-
+
/* initialise value using default value of property [#35856] */
nlaevalchan_value_init(nec);
*newChan = true;
}
else
*newChan = false;
-
+
/* we can now return */
return nec;
}
@@ -2136,7 +2136,7 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float
NlaStrip *strip = nes->strip;
short blendmode = strip->blendmode;
float inf = strip->influence;
-
+
/* for replace blend mode, and if this is the first strip,
* just replace the value regardless of the influence */
if (newChan && blendmode == NLASTRIP_MODE_REPLACE) {
@@ -2147,36 +2147,36 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float
/* if this is being performed as part of transition evaluation, incorporate
* an additional weighting factor for the influence
*/
- if (nes->strip_mode == NES_TIME_TRANSITION_END)
+ if (nes->strip_mode == NES_TIME_TRANSITION_END)
inf *= nes->strip_time;
-
+
/* optimisation: no need to try applying if there is no influence */
if (IS_EQF(inf, 0.0f)) return;
-
+
/* perform blending */
switch (blendmode) {
case NLASTRIP_MODE_ADD:
/* simply add the scaled value on to the stack */
nec->value += (value * inf);
break;
-
+
case NLASTRIP_MODE_SUBTRACT:
/* simply subtract the scaled value from the stack */
nec->value -= (value * inf);
break;
-
+
case NLASTRIP_MODE_MULTIPLY:
/* multiply the scaled value with the stack */
- /* Formula Used:
- * result = fac * (a * b) + (1 - fac) * a
+ /* Formula Used:
+ * result = fac * (a * b) + (1 - fac) * a
*/
nec->value = inf * (nec->value * value) + (1 - inf) * nec->value;
break;
-
+
case NLASTRIP_MODE_REPLACE:
default: /* TODO: do we really want to blend by default? it seems more uses might prefer add... */
- /* do linear interpolation
- * - the influence of the accumulated data (elsewhere, that is called dstweight)
+ /* do linear interpolation
+ * - the influence of the accumulated data (elsewhere, that is called dstweight)
* is 1 - influence, since the strip's influence is srcweight
*/
nec->value = nec->value * (1.0f - inf) + (value * inf);
@@ -2188,19 +2188,19 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float
static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buffer, NlaEvalStrip *nes)
{
NlaEvalChannel *nec, *necn, *necd;
-
+
/* optimize - abort if no channels */
if (BLI_listbase_is_empty(tmp_buffer))
return;
-
+
/* accumulate results in tmp_channels buffer to the accumulation buffer */
for (nec = tmp_buffer->first; nec; nec = necn) {
/* get pointer to next channel in case we remove the current channel from the temp-buffer */
necn = nec->next;
-
+
/* try to find an existing matching channel for this setting in the accumulation buffer */
necd = nlaevalchan_find_match(channels, &nec->ptr, nec->prop, nec->index);
-
+
/* if there was a matching channel already in the buffer, accumulate to it,
* otherwise, add the current channel to the buffer for efficiency
*/
@@ -2211,7 +2211,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf
BLI_addtail(channels, nec);
}
}
-
+
/* free temp-channels that haven't been assimilated into the buffer */
BLI_freelistN(tmp_buffer);
}
@@ -2223,7 +2223,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf
static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, ListBase *list2)
{
FModifier *fcm1, *fcm2;
-
+
/* if list1 is invalid... */
if (ELEM(NULL, list1, list1->first)) {
if (list2 && list2->first) {
@@ -2237,15 +2237,15 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li
result->last = list1->last;
}
else {
- /* list1 should be added first, and list2 second, with the endpoints of these being the endpoints for result
+ /* list1 should be added first, and list2 second, with the endpoints of these being the endpoints for result
* - the original lists must be left unchanged though, as we need that fact for restoring
*/
result->first = list1->first;
result->last = list2->last;
-
+
fcm1 = list1->last;
fcm2 = list2->first;
-
+
fcm1->next = fcm2;
fcm2->prev = fcm1;
}
@@ -2255,17 +2255,17 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li
static void nlaeval_fmodifiers_split_stacks(ListBase *list1, ListBase *list2)
{
FModifier *fcm1, *fcm2;
-
+
/* if list1/2 is invalid... just skip */
if (ELEM(NULL, list1, list2))
return;
if (ELEM(NULL, list1->first, list2->first))
return;
-
+
/* get endpoints */
fcm1 = list1->last;
fcm2 = list2->first;
-
+
/* clear their links */
fcm1->next = NULL;
fcm2->prev = NULL;
@@ -2281,48 +2281,48 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li
NlaStrip *strip = nes->strip;
FCurve *fcu;
float evaltime;
-
+
/* sanity checks for action */
if (strip == NULL)
return;
-
+
if (strip->act == NULL) {
printf("NLA-Strip Eval Error: Strip '%s' has no Action\n", strip->name);
return;
}
-
+
action_idcode_patch_check(ptr->id.data, strip->act);
-
+
/* join this strip's modifiers to the parent's modifiers (own modifiers first) */
nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers);
-
+
/* evaluate strip's modifiers which modify time to evaluate the base curves at */
storage = evaluate_fmodifiers_storage_new(&tmp_modifiers);
evaltime = evaluate_time_fmodifiers(storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time);
-
+
/* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */
for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) {
NlaEvalChannel *nec;
float value = 0.0f;
bool newChan;
-
+
/* check if this curve should be skipped */
if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED))
continue;
if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED))
continue;
-
- /* evaluate the F-Curve's value for the time given in the strip
- * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this
+
+ /* evaluate the F-Curve's value for the time given in the strip
+ * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this
*/
value = evaluate_fcurve(fcu, evaltime);
-
- /* apply strip's F-Curve Modifiers on this value
+
+ /* apply strip's F-Curve Modifiers on this value
* NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval)
*/
evaluate_value_fmodifiers(storage, &tmp_modifiers, fcu, &value, strip->strip_time);
-
-
+
+
/* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s)
* stored in this channel if it has been used already
*/
@@ -2345,11 +2345,11 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
ListBase tmp_modifiers = {NULL, NULL};
NlaEvalStrip tmp_nes;
NlaStrip *s1, *s2;
-
+
/* join this strip's modifiers to the parent's modifiers (own modifiers first) */
nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &nes->strip->modifiers, modifiers);
-
- /* get the two strips to operate on
+
+ /* get the two strips to operate on
* - we use the endpoints of the strips directly flanking our strip
* using these as the endpoints of the transition (destination and source)
* - these should have already been determined to be valid...
@@ -2364,8 +2364,8 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
s1 = nes->strip->prev;
s2 = nes->strip->next;
}
-
- /* prepare template for 'evaluation strip'
+
+ /* prepare template for 'evaluation strip'
* - based on the transition strip's evaluation strip data
* - strip_mode is NES_TIME_TRANSITION_* based on which endpoint
* - strip_time is the 'normalized' (i.e. in-strip) time for evaluation,
@@ -2373,23 +2373,23 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
* which allows us to appear to be 'interpolating' between the two extremes
*/
tmp_nes = *nes;
-
+
/* evaluate these strips into a temp-buffer (tmp_channels) */
/* FIXME: modifier evaluation here needs some work... */
/* first strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_START;
tmp_nes.strip = s1;
nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
-
+
/* second strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_END;
tmp_nes.strip = s2;
nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
-
-
+
+
/* accumulate temp-buffer and full-buffer, using the 'real' strip */
nlaevalchan_buffers_accumulate(channels, &tmp_channels, nes);
-
+
/* unlink this strip's modifiers from the parent's modifiers again */
nlaeval_fmodifiers_split_stacks(&nes->strip->modifiers, modifiers);
}
@@ -2401,32 +2401,32 @@ static void nlastrip_evaluate_meta(PointerRNA *ptr, ListBase *channels, ListBase
NlaStrip *strip = nes->strip;
NlaEvalStrip *tmp_nes;
float evaltime;
-
+
/* meta-strip was calculated normally to have some time to be evaluated at
* and here we 'look inside' the meta strip, treating it as a decorated window to
- * it's child strips, which get evaluated as if they were some tracks on a strip
+ * it's child strips, which get evaluated as if they were some tracks on a strip
* (but with some extra modifiers to apply).
*
* NOTE: keep this in sync with animsys_evaluate_nla()
*/
-
+
/* join this strip's modifiers to the parent's modifiers (own modifiers first) */
- nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers);
-
+ nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers);
+
/* find the child-strip to evaluate */
evaltime = (nes->strip_time * (strip->end - strip->start)) + strip->start;
tmp_nes = nlastrips_ctime_get_strip(NULL, &strip->strips, -1, evaltime);
-
- /* directly evaluate child strip into accumulation buffer...
+
+ /* directly evaluate child strip into accumulation buffer...
* - there's no need to use a temporary buffer (as it causes issues [T40082])
*/
if (tmp_nes) {
nlastrip_evaluate(ptr, channels, &tmp_modifiers, tmp_nes);
-
+
/* free temp eval-strip */
MEM_freeN(tmp_nes);
}
-
+
/* unlink this strip's modifiers from the parent's modifiers again */
nlaeval_fmodifiers_split_stacks(&strip->modifiers, modifiers);
}
@@ -2435,7 +2435,7 @@ static void nlastrip_evaluate_meta(PointerRNA *ptr, ListBase *channels, ListBase
void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
{
NlaStrip *strip = nes->strip;
-
+
/* to prevent potential infinite recursion problems (i.e. transition strip, beside meta strip containing a transition
* several levels deep inside it), we tag the current strip as being evaluated, and clear this when we leave
*/
@@ -2443,7 +2443,7 @@ void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers,
if (strip->flag & NLASTRIP_FLAG_EDIT_TOUCHED)
return;
strip->flag |= NLASTRIP_FLAG_EDIT_TOUCHED;
-
+
/* actions to take depend on the type of strip */
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* action-clip */
@@ -2455,11 +2455,11 @@ void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers,
case NLASTRIP_TYPE_META: /* meta */
nlastrip_evaluate_meta(ptr, channels, modifiers, nes);
break;
-
+
default: /* do nothing */
break;
}
-
+
/* clear temp recursion safe-check */
strip->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
}
@@ -2468,18 +2468,18 @@ void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers,
void nladata_flush_channels(ListBase *channels)
{
NlaEvalChannel *nec;
-
+
/* sanity checks */
if (channels == NULL)
return;
-
+
/* for each channel with accumulated values, write its value on the property it affects */
for (nec = channels->first; nec; nec = nec->next) {
PointerRNA *ptr = &nec->ptr;
PropertyRNA *prop = nec->prop;
int array_index = nec->index;
float value = nec->value;
-
+
/* write values - see animsys_write_rna_setting() to sync the code */
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
@@ -2524,19 +2524,19 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
NlaTrack *nlt;
short track_index = 0;
bool has_strips = false;
-
+
ListBase estrips = {NULL, NULL};
NlaEvalStrip *nes;
-
+
NlaStrip dummy_strip = {NULL}; /* dummy strip for active action */
-
-
+
+
/* 1. get the stack of strips to evaluate at current time (influence calculated here) */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next, track_index++) {
/* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */
if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED))
break;
-
+
/* solo and muting are mutually exclusive... */
if (adt->flag & ADT_NLA_SOLO_TRACK) {
/* skip if there is a solo track, but this isn't it */
@@ -2546,24 +2546,24 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
else {
/* no solo tracks - skip track if muted */
- if (nlt->flag & NLATRACK_MUTED)
+ if (nlt->flag & NLATRACK_MUTED)
continue;
}
-
- /* if this track has strips (but maybe they won't be suitable), set has_strips
+
+ /* if this track has strips (but maybe they won't be suitable), set has_strips
* - used for mainly for still allowing normal action evaluation...
*/
if (nlt->strips.first)
has_strips = true;
-
+
/* otherwise, get strip to evaluate for this channel */
nes = nlastrips_ctime_get_strip(&estrips, &nlt->strips, track_index, ctime);
if (nes) nes->track = nlt;
}
-
+
/* add 'active' Action (may be tweaking track) as last strip to evaluate in NLA stack
* - only do this if we're not exclusively evaluating the 'solo' NLA-track
- * - however, if the 'solo' track houses the current 'tweaking' strip,
+ * - however, if the 'solo' track houses the current 'tweaking' strip,
* then we should allow this to play, otherwise nothing happens
*/
if ((adt->action) && ((adt->flag & ADT_NLA_SOLO_TRACK) == 0 || (adt->flag & ADT_NLA_EDIT_ON))) {
@@ -2571,9 +2571,9 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
if ((has_strips) || (adt->actstrip)) {
/* make dummy NLA strip, and add that to the stack */
ListBase dummy_trackslist;
-
+
dummy_trackslist.first = dummy_trackslist.last = &dummy_strip;
-
+
if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) {
/* edit active action in-place according to its active strip, so copy the data */
memcpy(&dummy_strip, adt->actstrip, sizeof(NlaStrip));
@@ -2583,20 +2583,20 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
/* set settings of dummy NLA strip from AnimData settings */
dummy_strip.act = adt->action;
dummy_strip.remap = adt->remap;
-
+
/* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */
calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
dummy_strip.start = dummy_strip.actstart;
dummy_strip.end = (IS_EQF(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f) : (dummy_strip.actend);
-
+
dummy_strip.blendmode = adt->act_blendmode;
dummy_strip.extendmode = adt->act_extendmode;
dummy_strip.influence = adt->act_influence;
-
+
/* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */
dummy_strip.flag |= NLASTRIP_FLAG_USR_INFLUENCE;
}
-
+
/* add this to our list of evaluation strips */
nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime);
}
@@ -2604,22 +2604,22 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
/* special case - evaluate as if there isn't any NLA data */
/* TODO: this is really just a stop-gap measure... */
if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n");
-
+
animsys_evaluate_action(ptr, adt->action, adt->remap, ctime);
BLI_freelistN(&estrips);
return;
}
}
-
+
/* only continue if there are strips to evaluate */
if (BLI_listbase_is_empty(&estrips))
return;
-
-
+
+
/* 2. for each strip, evaluate then accumulate on top of existing channels, but don't set values yet */
for (nes = estrips.first; nes; nes = nes->next)
nlastrip_evaluate(ptr, echannels, NULL, nes);
-
+
/* 3. free temporary evaluation data that's not used elsewhere */
BLI_freelistN(&estrips);
@@ -2635,7 +2635,7 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
}
-/* NLA Evaluation function (mostly for use through do_animdata)
+/* NLA Evaluation function (mostly for use through do_animdata)
* - All channels that will be affected are not cleared anymore. Instead, we just evaluate into
* some temp channels, where values can be accumulated in one go.
*/
@@ -2648,15 +2648,15 @@ static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
/* evaluate the NLA stack, obtaining a set of values to flush */
animsys_evaluate_nla(&echannels, ptr, adt, ctime);
-
+
/* flush effects of accumulating channels in NLA to the actual data they affect */
nladata_flush_channels(&echannels);
-
+
/* free temp data */
BLI_freelistN(&echannels);
}
-/* ***************************************** */
+/* ***************************************** */
/* Overrides System - Public API */
/* Clear all overrides */
@@ -2676,7 +2676,7 @@ AnimOverride *BKE_animsys_validate_override(PointerRNA *UNUSED(ptr), char *UNUSE
static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
{
AnimOverride *aor;
-
+
/* for each override, simply execute... */
for (aor = adt->overrides.first; aor; aor = aor->next) {
PathResolvedRNA anim_rna;
@@ -2720,7 +2720,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
* However, the code for this is relatively harmless, so is left in the code for now.
*/
-/* Evaluation loop for evaluation animation data
+/* Evaluation loop for evaluation animation data
*
* This assumes that the animation-data provided belongs to the ID block in question,
* and that the flags for which parts of the anim-data settings need to be recalculated
@@ -2729,14 +2729,14 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
{
PointerRNA id_ptr;
-
+
/* sanity checks */
if (ELEM(NULL, id, adt))
return;
-
+
/* get pointer to ID-block for RNA to use */
RNA_id_pointer_create(id, &id_ptr);
-
+
/* recalculate keyframe data:
* - NLA before Active Action, as Active Action behaves as 'tweaking track'
* that overrides 'rough' work in NLA
@@ -2745,7 +2745,7 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
/* evaluate NLA data */
if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {
- /* evaluate NLA-stack
+ /* evaluate NLA-stack
* - active action is evaluated as part of the NLA stack as the last item
*/
animsys_calculate_nla(&id_ptr, adt, ctime);
@@ -2753,13 +2753,13 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
/* evaluate Active Action only */
else if (adt->action)
animsys_evaluate_action(&id_ptr, adt->action, adt->remap, ctime);
-
+
/* reset tag */
adt->recalc &= ~ADT_RECALC_ANIM;
}
-
- /* recalculate drivers
- * - Drivers need to be evaluated afterwards, as they can either override
+
+ /* recalculate drivers
+ * - Drivers need to be evaluated afterwards, as they can either override
* or be layered on top of existing animation data.
* - Drivers should be in the appropriate order to be evaluated without problems...
*/
@@ -2769,22 +2769,22 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
{
animsys_evaluate_drivers(&id_ptr, adt, ctime);
}
-
- /* always execute 'overrides'
+
+ /* always execute 'overrides'
* - Overrides allow editing, by overwriting the value(s) set from animation-data, with the
- * value last set by the user (and not keyframed yet).
+ * value last set by the user (and not keyframed yet).
* - Overrides are cleared upon frame change and/or keyframing
* - It is best that we execute this every time, so that no errors are likely to occur.
*/
animsys_evaluate_overrides(&id_ptr, adt);
-
+
/* execute and clear all cached property update functions */
if (scene) {
Main *bmain = G.main; // xxx - to get passed in!
RNA_property_update_cache_flush(bmain, scene);
RNA_property_update_cache_free();
}
-
+
/* clear recalc flag now */
adt->recalc = 0;
}
@@ -2802,10 +2802,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
if (G.debug & G_DEBUG)
printf("Evaluate all animation - %f\n", ctime);
-
- /* macros for less typing
+
+ /* macros for less typing
* - only evaluate animation data for id if it has users (and not just fake ones)
- * - whether animdata exists is checked for by the evaluation function, though taking
+ * - whether animdata exists is checked for by the evaluation function, though taking
* this outside of the function may make things slightly faster?
*/
#define EVAL_ANIM_IDS(first, aflag) \
@@ -2816,8 +2816,8 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
} \
} (void)0
- /* another macro for the "embedded" nodetree cases
- * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
+ /* another macro for the "embedded" nodetree cases
+ * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
* (i.e. scene/material/texture->nodetree) which we need a special exception
* for, otherwise they'd get skipped
* - ntp = "node tree parent" = datablock where node tree stuff resides
@@ -2834,10 +2834,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \
} \
} (void)0
-
- /* optimization:
- * when there are no actions, don't go over database and loop over heaps of datablocks,
- * which should ultimately be empty, since it is not possible for now to have any animation
+
+ /* optimization:
+ * when there are no actions, don't go over database and loop over heaps of datablocks,
+ * which should ultimately be empty, since it is not possible for now to have any animation
* without some actions, and drivers wouldn't get affected by any state changes
*
* however, if there are some curves, we will need to make sure that their 'ctime' property gets
@@ -2846,46 +2846,46 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
if (BLI_listbase_is_empty(&main->action) && BLI_listbase_is_empty(&main->curve)) {
if (G.debug & G_DEBUG)
printf("\tNo Actions, so no animation needs to be evaluated...\n");
-
+
return;
}
-
+
/* nodes */
EVAL_ANIM_IDS(main->nodetree.first, ADT_RECALC_ANIM);
-
+
/* textures */
EVAL_ANIM_NODETREE_IDS(main->tex.first, Tex, ADT_RECALC_ANIM);
-
+
/* lamps */
EVAL_ANIM_NODETREE_IDS(main->lamp.first, Lamp, ADT_RECALC_ANIM);
-
+
/* materials */
EVAL_ANIM_NODETREE_IDS(main->mat.first, Material, ADT_RECALC_ANIM);
-
+
/* cameras */
EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM);
-
+
/* shapekeys */
EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM);
-
+
/* metaballs */
EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM);
-
+
/* curves */
EVAL_ANIM_IDS(main->curve.first, ADT_RECALC_ANIM);
-
+
/* armatures */
EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM);
-
+
/* lattices */
EVAL_ANIM_IDS(main->latt.first, ADT_RECALC_ANIM);
-
+
/* meshes */
EVAL_ANIM_IDS(main->mesh.first, ADT_RECALC_ANIM);
-
+
/* particles */
EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM);
-
+
/* speakers */
EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM);
@@ -2894,31 +2894,31 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
/* linestyles */
EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM);
-
+
/* grease pencil */
EVAL_ANIM_IDS(main->gpencil.first, ADT_RECALC_ANIM);
/* cache files */
EVAL_ANIM_IDS(main->cachefiles.first, ADT_RECALC_ANIM);
-
+
/* objects */
/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets
* this tagged by Depsgraph on framechange. This optimization means that objects
* linked from other (not-visible) scenes will not need their data calculated.
*/
- EVAL_ANIM_IDS(main->object.first, 0);
+ EVAL_ANIM_IDS(main->object.first, 0);
/* masks */
EVAL_ANIM_IDS(main->mask.first, ADT_RECALC_ANIM);
-
+
/* worlds */
EVAL_ANIM_NODETREE_IDS(main->world.first, World, ADT_RECALC_ANIM);
-
+
/* scenes */
EVAL_ANIM_NODETREE_IDS(main->scene.first, Scene, ADT_RECALC_ANIM);
}
-/* ***************************************** */
+/* ***************************************** */
/* ************** */
/* Evaluation API */
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 01a5cc260ad..317994d4ed9 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -83,18 +83,18 @@ const char *BKE_appdir_folder_default(void)
if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) {
if (BLI_is_dir(documentfolder)) return documentfolder;
}
-
+
/* add user profile support for WIN 2K / NT.
* This is %APPDATA%, which translates to either
* %USERPROFILE%\Application Data or since Vista
* to %USERPROFILE%\AppData\Roaming
*/
hResult = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, documentfolder);
-
+
if (hResult == S_OK) {
if (BLI_is_dir(documentfolder)) return documentfolder;
}
-
+
return NULL;
#endif /* WIN32 */
}
@@ -120,7 +120,7 @@ static bool test_path(
const char *path_base, const char *path_sep, const char *folder_name)
{
char tmppath[FILE_MAX];
-
+
if (path_sep) {
BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
}
@@ -161,7 +161,7 @@ static bool test_env_path(char *path, const char *envvar)
{
const char *env = envvar ? getenv(envvar) : NULL;
if (!env) return false;
-
+
if (BLI_is_dir(env)) {
BLI_strncpy(path, env, FILE_MAX);
#ifdef PATH_DEBUG
@@ -193,7 +193,7 @@ static bool get_path_local(
const char *folder_name, const char *subfolder_name, const int ver)
{
char relfolder[FILE_MAX];
-
+
#ifdef PATH_DEBUG
printf("%s...\n", __func__);
#endif
@@ -276,11 +276,11 @@ static bool get_path_user(
if (!user_path[0])
return false;
-
+
#ifdef PATH_DEBUG
printf("%s: %s\n", __func__, user_path);
#endif
-
+
if (subfolder_name) {
return test_path(targetpath, targetpath_len, user_path, folder_name, subfolder_name);
}
@@ -334,14 +334,14 @@ static bool get_path_system(
system_base_path = (const char *)GHOST_getSystemDir(ver, blender_version_decimal(ver));
if (system_base_path)
BLI_strncpy(system_path, system_base_path, FILE_MAX);
-
+
if (!system_path[0])
return false;
-
+
#ifdef PATH_DEBUG
printf("%s: %s\n", __func__, system_path);
#endif
-
+
if (subfolder_name) {
/* try $BLENDERPATH/folder_name/subfolder_name */
return test_path(targetpath, targetpath_len, system_path, folder_name, subfolder_name);
@@ -371,16 +371,16 @@ const char *BKE_appdir_folder_id_ex(
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
return NULL;
-
+
case BLENDER_USER_DATAFILES:
if (get_path_user(path, path_len, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
return NULL;
-
+
case BLENDER_SYSTEM_DATAFILES:
if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
return NULL;
-
+
case BLENDER_USER_AUTOSAVE:
if (get_path_user(path, path_len, "autosave", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
return NULL;
@@ -388,16 +388,16 @@ const char *BKE_appdir_folder_id_ex(
case BLENDER_USER_CONFIG:
if (get_path_user(path, path_len, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break;
return NULL;
-
+
case BLENDER_USER_SCRIPTS:
if (get_path_user(path, path_len, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
return NULL;
-
+
case BLENDER_SYSTEM_SCRIPTS:
if (get_path_local(path, path_len, "scripts", subfolder, ver)) break;
if (get_path_system(path, path_len, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
return NULL;
-
+
case BLENDER_SYSTEM_PYTHON:
if (get_path_local(path, path_len, "python", subfolder, ver)) break;
if (get_path_system(path, path_len, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
@@ -407,7 +407,7 @@ const char *BKE_appdir_folder_id_ex(
BLI_assert(0);
break;
}
-
+
return path;
}
@@ -460,14 +460,14 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold
/* only for user folders */
if (!ELEM(folder_id, BLENDER_USER_DATAFILES, BLENDER_USER_CONFIG, BLENDER_USER_SCRIPTS, BLENDER_USER_AUTOSAVE))
return NULL;
-
+
path = BKE_appdir_folder_id(folder_id, subfolder);
-
+
if (!path) {
path = BKE_appdir_folder_id_user_notest(folder_id, subfolder);
if (path) BLI_dir_create_recursive(path);
}
-
+
return path;
}
@@ -739,8 +739,8 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
if (userdir && BLI_is_dir(userdir)) {
BLI_strncpy(fullname, userdir, maxlen);
}
-
-
+
+
#ifdef WIN32
if (fullname[0] == '\0') {
const char *tmp = getenv("TEMP"); /* Windows */
@@ -756,7 +756,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
BLI_strncpy(fullname, tmp, maxlen);
}
}
-
+
if (fullname[0] == '\0') {
const char *tmp = getenv("TMPDIR");
if (tmp && BLI_is_dir(tmp)) {
@@ -764,7 +764,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
}
}
#endif
-
+
if (fullname[0] == '\0') {
BLI_strncpy(fullname, "/tmp/", maxlen);
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 70a3772f388..b7a811b7574 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -641,17 +641,17 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
/* add extra rolls */
roll1 += bone->roll1 + (!rest ? pchan->roll1 : 0.0f);
roll2 += bone->roll2 + (!rest ? pchan->roll2 : 0.0f);
-
+
if (bone->flag & BONE_ADD_PARENT_END_ROLL) {
if (prev) {
if (prev->bone)
roll1 += prev->bone->roll2;
-
+
if (!rest)
roll1 += prev->roll2;
}
}
-
+
/* extra curve x / y */
/* NOTE: Scale correction factors here are to compensate for some random floating-point glitches
* when scaling up the bone or it's parent by a factor of approximately 8.15/6, which results
@@ -659,14 +659,14 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
*/
const float xscale_correction = (do_scale) ? scale[0] : 1.0f;
const float yscale_correction = (do_scale) ? scale[2] : 1.0f;
-
+
h1[0] += (bone->curveInX + (!rest ? pchan->curveInX : 0.0f)) * xscale_correction;
h1[2] += (bone->curveInY + (!rest ? pchan->curveInY : 0.0f)) * yscale_correction;
-
+
h2[0] += (bone->curveOutX + (!rest ? pchan->curveOutX : 0.0f)) * xscale_correction;
h2[2] += (bone->curveOutY + (!rest ? pchan->curveOutY : 0.0f)) * yscale_correction;
}
-
+
/* make curve */
if (bone->segments > MAX_BBONE_SUBDIV)
bone->segments = MAX_BBONE_SUBDIV;
@@ -682,39 +682,39 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
for (a = 0, fp = data[0]; a < bone->segments; a++, fp += 4) {
sub_v3_v3v3(h1, fp + 4, fp);
vec_roll_to_mat3(h1, fp[3], mat3); /* fp[3] is roll */
-
+
copy_m4_m3(result_array[a].mat, mat3);
copy_v3_v3(result_array[a].mat[3], fp);
-
+
if (do_scale) {
/* correct for scaling when this matrix is used in scaled space */
mul_m4_series(result_array[a].mat, iscalemat, result_array[a].mat, scalemat);
}
-
+
/* BBone scale... */
{
const int num_segments = bone->segments;
-
+
const float scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f);
const float scaleFactorIn = 1.0f + (scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
-
+
const float scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f);
const float scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments);
-
+
const float scalefac = scaleFactorIn * scaleFactorOut;
float bscalemat[4][4], bscale[3];
-
+
bscale[0] = scalefac;
bscale[1] = 1.0f;
bscale[2] = scalefac;
-
+
size_to_mat4(bscalemat, bscale);
-
+
/* Note: don't multiply by inverse scale mat here, as it causes problems with scaling shearing and breaking segment chains */
/*mul_m4_series(result_array[a].mat, ibscalemat, result_array[a].mat, bscalemat);*/
mul_m4_series(result_array[a].mat, result_array[a].mat, bscalemat);
}
-
+
}
}
@@ -773,10 +773,10 @@ static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float co[3], D
float (*mat)[4] = b_bone[0].mat;
float segment, y;
int a;
-
+
/* need to transform co back to bonespace, only need y */
y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
-
+
/* now calculate which of the b_bones are deforming this */
segment = bone->length / ((float)bone->segments);
a = (int)(y / segment);
@@ -1818,7 +1818,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
pchanp = BKE_pose_channel_find_name(frompose, pchan->name);
-
+
if (UNLIKELY(pchanp == NULL)) {
/* happens for proxies that become invalid because of a missing link
* for regular cases it shouldn't happen at all */
@@ -1826,7 +1826,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
else if (pchan->bone->layer & layer_protected) {
ListBase proxylocal_constraints = {NULL, NULL};
bPoseChannel pchanw;
-
+
/* copy posechannel to temp, but restore important pointers */
pchanw = *pchanp;
pchanw.bone = pchan->bone;
@@ -1842,13 +1842,13 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
/* this is freed so copy a copy, else undo crashes */
if (pchanw.prop) {
pchanw.prop = IDP_CopyProperty(pchanw.prop);
-
+
/* use the values from the existing props */
if (pchan->prop) {
IDP_SyncGroupValues(pchanw.prop, pchan->prop);
}
}
-
+
/* constraints - proxy constraints are flushed... local ones are added after
* 1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints
* 2. copy proxy-pchan's constraints on-to new
@@ -1860,29 +1860,29 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
BKE_constraints_proxylocal_extract(&proxylocal_constraints, &pchan->constraints);
BKE_constraints_copy(&pchanw.constraints, &pchanp->constraints, false);
BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints);
-
+
/* constraints - set target ob pointer to own object */
for (con = pchanw.constraints.first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
-
+
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar == from)
ct->tar = ob;
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 0);
}
}
-
+
/* free stuff from current channel */
BKE_pose_channel_free(pchan);
-
+
/* copy data in temp back over to the cleaned-out (but still allocated) original channel */
*pchan = pchanw;
if (pchan->custom) {
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index ee63e618b18..cb4237f51b4 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -116,7 +116,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
/* only happens on reload file, but violates depsgraph still... fix! */
if (ELEM(NULL, ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
BKE_displist_make_curveTypes(scene, ikData->tar, 0);
-
+
/* path building may fail in EditMode after removing verts [#33268]*/
if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
/* BLI_assert(cu->path != NULL); */
@@ -422,21 +422,21 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
{
/* improved volume preservation based on the Stretch To constraint */
float final_scale;
-
+
/* as the basis for volume preservation, we use the inverse scale factor... */
if (fabsf(scaleFac) != 0.0f) {
/* NOTE: The method here is taken wholesale from the Stretch To constraint */
float bulge = powf(1.0f / fabsf(scaleFac), ikData->bulge);
-
+
if (bulge > 1.0f) {
if (ikData->flag & CONSTRAINT_SPLINEIK_USE_BULGE_MAX) {
float bulge_max = max_ff(ikData->bulge_max, 1.0f);
float hard = min_ff(bulge, bulge_max);
-
+
float range = bulge_max - 1.0f;
float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
-
+
bulge = interpf(soft, hard, ikData->bulge_smooth);
}
}
@@ -444,15 +444,15 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
if (ikData->flag & CONSTRAINT_SPLINEIK_USE_BULGE_MIN) {
float bulge_min = CLAMPIS(ikData->bulge_min, 0.0f, 1.0f);
float hard = max_ff(bulge, bulge_min);
-
+
float range = 1.0f - bulge_min;
float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
-
+
bulge = interpf(soft, hard, ikData->bulge_smooth);
}
}
-
+
/* compute scale factor for xz axes from this value */
final_scale = sqrtf(bulge);
}
@@ -460,7 +460,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* no scaling, so scale factor is simple */
final_scale = 1.0f;
}
-
+
/* apply the scaling (assuming normalised scale) */
mul_v3_fl(poseMat[0], final_scale);
mul_v3_fl(poseMat[2], final_scale);
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 68bca5d11b9..ba20dbaddb0 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -88,20 +88,20 @@ void BKE_blender_free(void)
}
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
-
+
IMB_exit();
BKE_cachefiles_exit();
BKE_images_exit();
DAG_exit();
BKE_brush_system_exit();
- RE_texture_rng_exit();
+ RE_texture_rng_exit();
BLI_callback_global_finalize();
BKE_sequencer_cache_destruct();
IMB_moviecache_destruct();
-
+
free_nodesystem();
}
@@ -120,7 +120,7 @@ void BKE_blender_version_string(char *version_str, size_t maxncpy, short version
void BKE_blender_globals_init(void)
{
memset(&G, 0, sizeof(Global));
-
+
U.savetime = 1;
G_MAIN = BKE_main_new();
@@ -321,7 +321,7 @@ int BKE_blender_test_break(void)
if (blender_test_break_cb)
blender_test_break_cb();
}
-
+
return (G.is_break == true);
}
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 8018629ef2a..c99894bfbaf 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -71,7 +71,7 @@ void calcAlpha(ImBuf *ibuf)
{
int i;
char *rect;
-
+
if (ibuf) {
rect = (char *) ibuf->rect;
for (i = ibuf->x * ibuf->y; i > 0; i--) {
@@ -86,21 +86,21 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step)
int glyphcount, bytes, i, index, linelength, ysize;
unsigned char *buffer;
bmFont * bmfont;
-
+
linelength = ibuf->x * step;
-
+
glyphcount = (rect[6 * step] << 8) | rect[7 * step];
bytes = ((glyphcount - 1) * sizeof(bmGlyph)) + sizeof(bmFont);
-
+
ysize = (bytes + (ibuf->x - 1)) / ibuf->x;
-
+
if (ysize < ibuf->y) {
/* we're first going to copy all data into a linear buffer.
* step can be 4 or 1 bytes, and the data is not sequential because
* the bitmap was flipped vertically. */
-
+
buffer = MEM_mallocN(bytes, "readBitmapFontVersion0:buffer");
-
+
index = 0;
for (i = 0; i < bytes; i++) {
buffer[i] = rect[index];
@@ -111,12 +111,12 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step)
index -= linelength;
}
}
-
+
/* we're now going to endian convert the data */
-
+
bmfont = MEM_mallocN(bytes, "readBitmapFontVersion0:bmfont");
index = 0;
-
+
/* first read the header */
bmfont->magic[0] = buffer[index++];
bmfont->magic[1] = buffer[index++];
@@ -126,7 +126,7 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step)
bmfont->glyphcount = (buffer[index] << 8) | buffer[index + 1]; index += 2;
bmfont->xsize = (buffer[index] << 8) | buffer[index + 1]; index += 2;
bmfont->ysize = (buffer[index] << 8) | buffer[index + 1]; index += 2;
-
+
for (i = 0; i < bmfont->glyphcount; i++) {
bmfont->glyphs[i].unicode = (buffer[index] << 8) | buffer[index + 1]; index += 2;
bmfont->glyphs[i].locx = (buffer[index] << 8) | buffer[index + 1]; index += 2;
@@ -141,9 +141,9 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step)
printfGlyph(&bmfont->glyphs[i]);
}
}
-
+
MEM_freeN(buffer);
-
+
if (G.debug & G_DEBUG) {
printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize);
printf("glyphcount = %d\n", glyphcount);
@@ -173,7 +173,7 @@ void detectBitmapFont(ImBuf *ibuf)
unsigned char *rect;
unsigned short version;
int i;
-
+
if (ibuf != NULL && ibuf->rect != NULL) {
/* bitmap must have an x size that is a power of two */
if (is_power_of_two(ibuf->x)) {
@@ -215,7 +215,7 @@ void detectBitmapFont(ImBuf *ibuf)
int locateGlyph(bmFont *bmfont, unsigned short unicode)
{
int min, max, current = 0;
-
+
if (bmfont) {
min = 0;
max = bmfont->glyphcount;
@@ -242,7 +242,7 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode)
}
}
}
-
+
return(current);
}
@@ -256,19 +256,19 @@ void matrixGlyph(
{
int index;
bmFont *bmfont;
-
+
*centerx = *centery = 0.0;
*sizex = *sizey = 1.0;
*transx = *transy = 0.0;
*movex = *movey = 0.0;
*advance = 1.0;
-
+
if (ibuf) {
bmfont = ibuf->userdata;
if (bmfont && (ibuf->userflags & IB_BITMAPFONT)) {
index = locateGlyph(bmfont, unicode);
if (index) {
-
+
*sizex = (bmfont->glyphs[index].sizex) / (float) (bmfont->glyphs[0].sizex);
*sizey = (bmfont->glyphs[index].sizey) / (float) (bmfont->glyphs[0].sizey);
@@ -279,10 +279,10 @@ void matrixGlyph(
*centery = (ibuf->y - bmfont->glyphs[0].locy) / (float) ibuf->y;
/* 2.0 units is the default size of an object */
-
+
*movey = 1.0f - *sizey + 2.0f * (bmfont->glyphs[index].ofsy - bmfont->glyphs[0].ofsy) / (float) bmfont->glyphs[0].sizey;
*movex = *sizex - 1.0f + 2.0f * (bmfont->glyphs[index].ofsx - bmfont->glyphs[0].ofsx) / (float) bmfont->glyphs[0].sizex;
-
+
*advance = 2.0f * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance;
// printfGlyph(&bmfont->glyphs[index]);
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 024c0aeb23f..39f8d7703ab 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -276,7 +276,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
sub_v3_v3v3(loc, co1, co2);
sub_v3_v3v3(vec, vel1, vel2);
-
+
inp = dot_v3v3(vec, vec);
/* velocities not parallel */
@@ -286,7 +286,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
if (t > 0.0f && t < t_min) {
madd_v3_v3fl(co1, vel1, t);
madd_v3_v3fl(co2, vel2, t);
-
+
sub_v3_v3v3(vec, co2, co1);
len = normalize_v3(vec);
@@ -326,7 +326,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
sub_v3_v3v3(loc, co1, co2);
sub_v3_v3v3(vec, vel1, vel2);
-
+
inp = dot_v3v3(vec, vec);
/* velocities not parallel */
@@ -336,7 +336,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
if (t > 0.0f && t < t_min) {
madd_v3_v3fl(co1, vel1, t);
madd_v3_v3fl(co2, vel2, t);
-
+
sub_v3_v3v3(vec, co2, co1);
len = normalize_v3(vec);
@@ -394,7 +394,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
neighbors = BLI_kdtree_range_search(
epsys->tree, pa->prev_state.co,
&ptn, 2.0f * val->personal_space * pa->size);
-
+
if (neighbors > 0 && ptn[0].dist < len) {
sub_v3_v3v3(vec, pa->prev_state.co, ptn[0].co);
mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist);
@@ -496,13 +496,13 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
mul_v3_fl(vec, 1.0f/bbd->timestep);
}
-
+
/* fac is seconds behind leader */
madd_v3_v3fl(loc, vec, -flbr->distance);
sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
bbd->wanted_speed = len_v3(bbd->wanted_co);
-
+
ret = 1;
}
else if (p % n) {
@@ -559,13 +559,13 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
copy_v3_v3(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel);
copy_v3_v3(loc, bbd->sim->psys->particles[p - p%n].prev_state.co);
}
-
+
/* fac is seconds behind leader */
madd_v3_v3fl(loc, vec, -flbr->distance);
sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
bbd->wanted_speed = len_v3(bbd->wanted_co);
-
+
ret = 1;
}
@@ -611,7 +611,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
bbd->wanted_co[1] = 2.0f*(0.5f - BLI_rng_get_float(bbd->rng));
bbd->wanted_co[2] = 2.0f*(0.5f - BLI_rng_get_float(bbd->rng));
}
-
+
/* leveling */
if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity);
@@ -621,7 +621,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
}
bbd->wanted_speed = asbr->speed * val->max_speed;
-
+
return 1;
}
static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
@@ -661,7 +661,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
neighbors = BLI_kdtree_range_search(
epsys->tree, pa->prev_state.co,
&ptn, fbr->distance);
-
+
health = 0.0f;
for (n=0; n<neighbors; n++) {
@@ -775,7 +775,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
if (bpa->data.mode == eBoidMode_Climbing) {
SurfaceModifierData *surmd = NULL;
float x[3], v[3];
-
+
surmd = (SurfaceModifierData *)modifiers_findByType(bpa->ground, eModifierType_Surface );
/* take surface velocity into account */
@@ -868,10 +868,10 @@ static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), Boid
if (rule==NULL)
return 0;
-
+
if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND)
return 1;
-
+
if (bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR)
return 1;
@@ -1049,7 +1049,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
if (bpa->data.mode == eBoidMode_OnLand) {
/* fuzziness makes boids capable of misjudgement */
float mul = 1.0f + state->rule_fuzziness;
-
+
if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
float cvel[3], dir[3];
@@ -1165,7 +1165,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* auto-leveling & landing if close to ground */
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
-
+
/* level = how many particle sizes above ground */
level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5f;
@@ -1226,7 +1226,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* constrain speed with maximum acceleration */
old_speed = len_v3(pa->prev_state.vel);
-
+
if (bbd->wanted_speed < old_speed)
new_speed = MAX2(bbd->wanted_speed, old_speed - val.max_acc);
else
@@ -1273,7 +1273,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
mul_v3_fl(force, length);
}
-
+
add_v3_v3(acc, force);
/* store smoothed acceleration for nice banking etc. */
@@ -1288,7 +1288,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
copy_v3_v3(dvec, acc);
mul_v3_fl(dvec, dtime*dtime*0.5f);
-
+
copy_v3_v3(bvec, pa->prev_state.vel);
mul_v3_fl(bvec, dtime);
add_v3_v3(dvec, bvec);
@@ -1467,7 +1467,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
}
negate_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
-
+
/* apply rotation */
mat3_to_quat_is_ok(q, mat);
copy_qt_qt(pa->state.rot, q);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 7f50e521e63..42cd7968321 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -271,7 +271,7 @@ void BKE_brush_debug_print_state(Brush *br)
/* create a fake brush and set it to the defaults */
Brush def = {{NULL}};
brush_defaults(&def);
-
+
#define BR_TEST(field, t) \
if (br->field != def.field) \
printf("br->" #field " = %" #t ";\n", br->field)
@@ -281,7 +281,7 @@ void BKE_brush_debug_print_state(Brush *br)
printf("br->flag |= " #_f ";\n"); \
else if (!(br->flag & _f) && (def.flag & _f)) \
printf("br->flag &= ~" #_f ";\n")
-
+
#define BR_TEST_FLAG_OVERLAY(_f) \
if ((br->overlay_flags & _f) && !(def.overlay_flags & _f)) \
printf("br->overlay_flags |= " #_f ";\n"); \
@@ -355,7 +355,7 @@ void BKE_brush_debug_print_state(Brush *br)
BR_TEST(sub_col[2], f);
printf("\n");
-
+
#undef BR_TEST
#undef BR_TEST_FLAG
}
@@ -757,7 +757,7 @@ int BKE_brush_size_get(const Scene *scene, const Brush *brush)
{
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
int size = (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size;
-
+
return size;
}
diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c
index c16c0f7af31..827577d873b 100644
--- a/source/blender/blenkernel/intern/bullet.c
+++ b/source/blender/blenkernel/intern/bullet.c
@@ -44,25 +44,25 @@
BulletSoftBody *bsbNew(void)
{
BulletSoftBody *bsb;
-
+
bsb = MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
-
+
bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
bsb->linStiff = 0.5f;
bsb->angStiff = 1.0f;
bsb->volume = 1.0f;
-
+
bsb->viterations = 0;
bsb->piterations = 2;
bsb->diterations = 0;
bsb->citerations = 4;
-
+
bsb->kSRHR_CL = 0.1f;
bsb->kSKHR_CL = 1.f;
bsb->kSSHR_CL = 0.5f;
bsb->kSR_SPLT_CL = 0.5f;
-
+
bsb->kSK_SPLT_CL = 0.5f;
bsb->kSS_SPLT_CL = 0.5f;
bsb->kVCF = 1;
@@ -80,7 +80,7 @@ BulletSoftBody *bsbNew(void)
bsb->kSHR = 1.0f;
bsb->kAHR = 0.7f;
-
+
bsb->collisionflags = 0;
//bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
bsb->numclusteriterations = 64;
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 3c0f38939fe..c678f71dff9 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -76,7 +76,7 @@ float bvhtree_sphereray_tri_intersection(
const BVHTreeRay *ray, float radius, const float m_dist,
const float v0[3], const float v1[3], const float v2[3])
{
-
+
float idist;
float p1[3];
float hit_point[3];
@@ -107,7 +107,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
t2 = vert[face->v3].co;
t3 = face->v4 ? vert[face->v4].co : NULL;
-
+
do {
float nearest_tmp[3], dist_sq;
@@ -191,7 +191,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
t2 = vert[face->v3].co;
t3 = face->v4 ? vert[face->v4].co : NULL;
-
+
do {
float dist;
if (ray->radius == 0.0f)
@@ -284,7 +284,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3
closest_to_line_segment_v3(nearest_tmp, co, t0, t1);
dist_sq = len_squared_v3v3(nearest_tmp, co);
-
+
if (dist_sq < nearest->dist_sq) {
nearest->index = index;
nearest->dist_sq = dist_sq;
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index ed4938cf3d2..bda26c95815 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -139,7 +139,7 @@ void BKE_camera_object_mode(RenderData *rd, Object *cam_ob)
/* get the camera's dof value, takes the dof object into account */
float BKE_camera_object_dof_distance(Object *ob)
{
- Camera *cam = (Camera *)ob->data;
+ Camera *cam = (Camera *)ob->data;
if (ob->type != OB_CAMERA)
return 0.0f;
if (cam->dof_ob) {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 1a34b71643f..1c5b1ca242c 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -289,7 +289,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color);
pbvh_show_mask_set(cddm->pbvh, ob->sculpt->show_mask);
}
-
+
/* always build pbvh from original mesh, and only use it for drawing if
* this derivedmesh is just original mesh. it's the multires subsurf dm
@@ -310,7 +310,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
me->mvert,
me->totloop, me->totpoly,
looptri);
-
+
BKE_pbvh_build_mesh(
cddm->pbvh,
me->mpoly, me->mloop,
@@ -417,7 +417,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdg
return;
}
-
+
GPU_edge_setup(dm);
gdo = dm->drawObject;
if (gdo->edges && gdo->points) {
@@ -469,7 +469,7 @@ static void cdDM_drawFacesSolid(
return;
}
}
-
+
GPU_vertex_setup(dm);
GPU_normal_setup(dm);
GPU_triangle_setup(dm);
@@ -630,7 +630,7 @@ static void cdDM_drawFacesTex_common(
}
GPU_buffers_unbind();
-
+
}
static void cdDM_drawFacesTex(
@@ -966,8 +966,8 @@ static void cdDM_drawMappedFacesGLSL(
if (orig == ORIGINDEX_NONE) {
/* since the material is set by setMaterial(), faces with no
- * origin can be assumed to be generated by a modifier */
-
+ * origin can be assumed to be generated by a modifier */
+
/* continue */
}
else if (setDrawOptions(userData, orig) == DM_DRAW_OPTION_SKIP)
@@ -990,7 +990,7 @@ static void cdDM_drawMappedFacesGLSL(
ln2 = lnors[ltri[1]];
ln3 = lnors[ltri[2]];
}
-
+
cddm_draw_attrib_vertex(&attribs, mvert, a, vtri[0], ltri[0], 0, ln1, smoothnormal);
cddm_draw_attrib_vertex(&attribs, mvert, a, vtri[1], ltri[1], 1, ln2, smoothnormal);
cddm_draw_attrib_vertex(&attribs, mvert, a, vtri[2], ltri[2], 2, ln3, smoothnormal);
@@ -1883,7 +1883,7 @@ static void cdDM_foreachMappedFaceCenter(
else {
orig = i;
}
-
+
ml = &cddm->mloop[mp->loopstart];
BKE_mesh_calc_poly_center(mp, ml, mvert, cent);
@@ -2182,9 +2182,9 @@ static void loops_to_customdata_corners(
for (i = 0; i < numTex; i++) {
texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i);
texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i);
-
+
ME_MTEXFACE_CPY(texface, texpoly);
-
+
for (j = 0; j < 3; j++) {
l = l3[j];
mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
@@ -2194,7 +2194,7 @@ static void loops_to_customdata_corners(
for (i = 0; i < numCol; i++) {
mcol = CustomData_get_n(facedata, CD_MCOL, cdindex, i);
-
+
for (j = 0; j < 3; j++) {
l = l3[j];
mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i);
@@ -2241,18 +2241,18 @@ static DerivedMesh *cddm_from_bmesh_ex(
int *index, add_orig;
CustomDataMask mask;
unsigned int i, j;
-
+
const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
-
+
dm->deformedOnly = 1;
-
+
/* don't add origindex layer if one already exists */
add_orig = !CustomData_has_layer(&bm->pdata, CD_ORIGINDEX);
mask = use_mdisps ? CD_MASK_DERIVEDMESH | CD_MASK_MDISPS : CD_MASK_DERIVEDMESH;
-
+
/* don't process shapekeys, we only feed them through the modifier stack as needed,
* e.g. for applying modifiers or the like*/
mask &= ~CD_MASK_SHAPEKEY;
@@ -2343,7 +2343,7 @@ static DerivedMesh *cddm_from_bmesh_ex(
test_index_face(mf, &dm->faceData, i, 3);
}
}
-
+
index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
j = 0;
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
@@ -3044,7 +3044,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
newv[i] = 0;
}
}
-
+
/* now link target vertices to destination indices */
for (i = 0; i < totvert; i++) {
if (vtargetmap[i] != -1) {
@@ -3081,7 +3081,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
newe[i] = -1;
}
}
-
+
if (merge_mode == CDDM_MERGE_VERTS_DUMP_IF_EQUAL) {
/* In this mode, we need to determine, whenever a poly' vertices are all mapped */
/* if the targets already make up a poly, in which case the new poly is dropped */
@@ -3122,7 +3122,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
mv = cddm->mvert;
for (i = 0; i < totpoly; i++, mp++) {
MPoly *mp_new;
-
+
ml = cddm->mloop + mp->loopstart;
/* check faces with all vertices merged */
@@ -3326,7 +3326,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
mp_new->totloop = c;
BLI_assert(mp_new->totloop >= 3);
mp_new->loopstart = STACK_SIZE(mloop) - c;
-
+
STACK_PUSH(oldp, i);
} /* end of the loop that tests polys */
@@ -3337,11 +3337,11 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
BLI_gset_free(poly_gset, NULL);
MEM_freeN(poly_keys);
}
-
+
/*create new cddm*/
cddm2 = (CDDerivedMesh *)CDDM_from_template(
(DerivedMesh *)cddm, STACK_SIZE(mvert), STACK_SIZE(medge), 0, STACK_SIZE(mloop), STACK_SIZE(mpoly));
-
+
/*update edge indices and copy customdata*/
med = medge;
for (i = 0; i < cddm2->dm.numEdgeData; i++, med++) {
@@ -3355,7 +3355,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
CustomData_copy_data(&dm->edgeData, &cddm2->dm.edgeData, olde[i], i, 1);
}
-
+
/*update loop indices and copy customdata*/
ml = mloop;
for (i = 0; i < cddm2->dm.numLoopData; i++, ml++) {
@@ -3365,19 +3365,19 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1);
}
-
+
/*copy vertex customdata*/
mv = mvert;
for (i = 0; i < cddm2->dm.numVertData; i++, mv++) {
CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1);
}
-
+
/*copy poly customdata*/
mp = mpoly;
for (i = 0; i < cddm2->dm.numPolyData; i++, mp++) {
CustomData_copy_data(&dm->polyData, &cddm2->dm.polyData, oldp[i], i, 1);
}
-
+
/*copy over data. CustomData_add_layer can do this, need to look it up.*/
memcpy(cddm2->mvert, mvert, sizeof(MVert) * STACK_SIZE(mvert));
memcpy(cddm2->medge, medge, sizeof(MEdge) * STACK_SIZE(medge));
@@ -3405,7 +3405,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
/*free old derivedmesh*/
dm->needsFree = 1;
dm->release(dm);
-
+
return (DerivedMesh *)cddm2;
}
#endif
@@ -3425,7 +3425,7 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
for (i = 0; i < numFaces; i++, mf++) {
BLI_edgeset_add(eh, mf->v1, mf->v2);
BLI_edgeset_add(eh, mf->v2, mf->v3);
-
+
if (mf->v4) {
BLI_edgeset_add(eh, mf->v3, mf->v4);
BLI_edgeset_add(eh, mf->v4, mf->v1);
@@ -3671,7 +3671,7 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm)
void CDDM_set_mvert(DerivedMesh *dm, MVert *mvert)
{
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-
+
if (!CustomData_has_layer(&dm->vertData, CD_MVERT))
CustomData_add_layer(&dm->vertData, CD_MVERT, CD_ASSIGN, mvert, dm->numVertData);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 9ae295e2e3b..a91f3b909e1 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -75,7 +75,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm );
* 2. fill object with standard values or with the GUI settings if given
*/
void cloth_init(ClothModifierData *clmd )
-{
+{
/* Initialize our new data structure to reasonable values. */
clmd->sim_parms->gravity[0] = 0.0;
clmd->sim_parms->gravity[1] = 0.0;
@@ -86,7 +86,7 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->bending = 0.5;
clmd->sim_parms->max_bend = 0.5;
clmd->sim_parms->bending_damping = 0.5;
- clmd->sim_parms->Cdis = 5.0;
+ clmd->sim_parms->Cdis = 5.0;
clmd->sim_parms->Cvi = 1.0;
clmd->sim_parms->mass = 0.3f;
clmd->sim_parms->stepsPerFrame = 5;
@@ -102,7 +102,7 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->time_scale = 1.0f; /* multiplies cloth speed */
clmd->sim_parms->reset = 0;
clmd->sim_parms->vel_damping = 1.0f; /* 1.0 = no damping, 0.0 = fully dampened */
-
+
clmd->coll_parms->self_friction = 5.0;
clmd->coll_parms->friction = 5.0;
clmd->coll_parms->loop_count = 2;
@@ -150,27 +150,27 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps
if (!cloth)
return NULL;
-
+
verts = cloth->verts;
-
+
/* in the moment, return zero if no faces there */
if (!cloth->mvert_num)
return NULL;
-
+
/* create quadtree with k=26 */
bvhtree = BLI_bvhtree_new(cloth->mvert_num, epsilon, 4, 6);
-
+
/* fill tree */
for (i = 0; i < cloth->mvert_num; i++, verts++) {
const float *co;
co = verts->xold;
-
+
BLI_bvhtree_insert(bvhtree, i, co, 1);
}
-
+
/* balance tree */
BLI_bvhtree_balance(bvhtree);
-
+
return bvhtree;
}
@@ -189,10 +189,10 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
if (!cloth)
return NULL;
-
+
verts = cloth->verts;
vt = cloth->tri;
-
+
/* in the moment, return zero if no faces there */
if (!cloth->tri_num)
return NULL;
@@ -213,23 +213,23 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
/* balance tree */
BLI_bvhtree_balance(bvhtree);
-
+
return bvhtree;
}
void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving)
-{
+{
unsigned int i = 0;
Cloth *cloth = clmd->clothObject;
BVHTree *bvhtree = cloth->bvhtree;
ClothVertex *verts = cloth->verts;
const MVertTri *vt;
-
+
if (!bvhtree)
return;
-
+
vt = cloth->tri;
-
+
/* update vertex position in bvh tree */
if (verts && vt) {
for (i = 0; i < cloth->tri_num; i++, vt++) {
@@ -252,25 +252,25 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving)
else {
ret = BLI_bvhtree_update_node(bvhtree, i, co[0], NULL, 3);
}
-
+
/* check if tree is already full */
if (ret == false) {
break;
}
}
-
+
BLI_bvhtree_update_tree(bvhtree);
}
}
void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving)
-{
+{
unsigned int i = 0;
Cloth *cloth = clmd->clothObject;
BVHTree *bvhtree = cloth->bvhselftree;
ClothVertex *verts = cloth->verts;
const MVertTri *vt;
-
+
if (!bvhtree)
return;
@@ -299,7 +299,7 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving)
break;
}
}
-
+
BLI_bvhtree_update_tree(bvhtree);
}
}
@@ -307,13 +307,13 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving)
void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
{
PTCacheID pid;
-
+
BKE_ptcache_id_from_cloth(&pid, ob, clmd);
// don't do anything as long as we're in editmode!
if (pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
return;
-
+
BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr);
}
@@ -330,13 +330,13 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
modifier_setError(&(clmd->modifier), "Can't initialize cloth");
return 0;
}
-
+
if (clmd->clothObject == NULL) {
BKE_ptcache_invalidate(cache);
modifier_setError(&(clmd->modifier), "Null cloth object");
return 0;
}
-
+
BKE_cloth_solver_set_positions(clmd);
clmd->clothObject->last_frame= MINFRAME-1;
@@ -382,7 +382,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
cloth_update_spring_lengths ( clmd, result );
cloth_update_springs( clmd );
-
+
// TIMEIT_START(cloth_step)
/* call the solver. */
@@ -393,7 +393,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
pdEndEffectors(&effectors);
// printf ( "%f\n", ( float ) tval() );
-
+
return ret;
}
@@ -424,7 +424,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
cache->last_exact= 0;
cache->flag &= ~PTCACHE_REDO_NEEDED;
}
-
+
// unused in the moment, calculated separately in implicit.c
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
@@ -505,13 +505,13 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
void cloth_free_modifier(ClothModifierData *clmd )
{
Cloth *cloth = NULL;
-
+
if ( !clmd )
return;
cloth = clmd->clothObject;
-
+
if ( cloth ) {
BPH_cloth_solver_free(clmd);
@@ -527,12 +527,12 @@ void cloth_free_modifier(ClothModifierData *clmd )
LinkNode *search = cloth->springs;
while (search) {
ClothSpring *spring = search->link;
-
+
MEM_freeN ( spring );
search = search->next;
}
BLI_linklist_free(cloth->springs, NULL);
-
+
cloth->springs = NULL;
}
@@ -542,7 +542,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
// free BVH collision tree
if ( cloth->bvhtree )
BLI_bvhtree_free ( cloth->bvhtree );
-
+
if ( cloth->bvhselftree )
BLI_bvhtree_free ( cloth->bvhselftree );
@@ -552,8 +552,8 @@ void cloth_free_modifier(ClothModifierData *clmd )
if (cloth->edgeset)
BLI_edgeset_free(cloth->edgeset);
-
-
+
+
/*
if (clmd->clothObject->facemarks)
MEM_freeN(clmd->clothObject->facemarks);
@@ -569,12 +569,12 @@ void cloth_free_modifier_extern(ClothModifierData *clmd )
Cloth *cloth = NULL;
if (G.debug_value > 0)
printf("cloth_free_modifier_extern\n");
-
+
if ( !clmd )
return;
cloth = clmd->clothObject;
-
+
if ( cloth ) {
if (G.debug_value > 0)
printf("cloth_free_modifier_extern in\n");
@@ -608,7 +608,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd )
// free BVH collision tree
if ( cloth->bvhtree )
BLI_bvhtree_free ( cloth->bvhtree );
-
+
if ( cloth->bvhselftree )
BLI_bvhtree_free ( cloth->bvhselftree );
@@ -658,11 +658,11 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, float (*verte
int cloth_uses_vgroup(ClothModifierData *clmd)
{
- return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) ||
+ return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) ||
(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) ||
(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW) ||
- (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF)) &&
- ((clmd->sim_parms->vgroup_mass>0) ||
+ (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF)) &&
+ ((clmd->sim_parms->vgroup_mass>0) ||
(clmd->sim_parms->vgroup_struct>0)||
(clmd->sim_parms->vgroup_bend>0) ||
(clmd->sim_parms->vgroup_shrink>0) ||
@@ -691,7 +691,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
mvert_num = dm->getNumVerts(dm);
verts = clothObj->verts;
-
+
if (cloth_uses_vgroup(clmd)) {
for (i = 0; i < mvert_num; i++, verts++) {
@@ -715,21 +715,21 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
verts->goal = dvert->dw [j].weight;
/* goalfac= 1.0f; */ /* UNUSED */
-
+
// Kicking goal factor to simplify things...who uses that anyway?
// ABS ( clmd->sim_parms->maxgoal - clmd->sim_parms->mingoal );
-
+
verts->goal = pow4f(verts->goal);
if ( verts->goal >= SOFTGOALSNAP )
verts->flags |= CLOTH_VERT_FLAG_PINNED;
}
-
+
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) {
if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1)) {
verts->struct_stiff = dvert->dw [j].weight;
verts->shear_stiff = dvert->dw [j].weight;
}
-
+
if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1)) {
verts->bend_stiff = dvert->dw [j].weight;
}
@@ -784,7 +784,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
Cloth *cloth = NULL;
float maxdist = 0;
- // If we have a clothObject, free it.
+ // If we have a clothObject, free it.
if ( clmd->clothObject != NULL ) {
cloth_free_modifier ( clmd );
if (G.debug_value > 0)
@@ -835,9 +835,9 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
else
copy_v3_v3(verts->xrest, verts->x);
}
-
+
/* no GUI interface yet */
- verts->mass = clmd->sim_parms->mass;
+ verts->mass = clmd->sim_parms->mass;
verts->impulse_count = 0;
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
@@ -857,7 +857,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
verts->impulse_count = 0;
copy_v3_v3 ( verts->impulse, tnull );
}
-
+
// apply / set vertex groups
// has to be happen before springs are build!
cloth_apply_vgroup (clmd, dm);
@@ -868,19 +868,19 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
printf("cloth_free_modifier cloth_build_springs\n");
return 0;
}
-
+
// init our solver
BPH_cloth_solver_init(ob, clmd);
-
+
if (!first)
BKE_cloth_solver_set_positions(clmd);
clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) );
-
+
for (i = 0; i < dm->getNumVerts(dm); i++) {
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
}
-
+
clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist );
return 1;
@@ -956,17 +956,17 @@ static void cloth_free_errorsprings(Cloth *cloth, LinkNodePair *edgelist)
LinkNode *search = cloth->springs;
while (search) {
ClothSpring *spring = search->link;
-
+
MEM_freeN ( spring );
search = search->next;
}
BLI_linklist_free(cloth->springs, NULL);
-
+
cloth->springs = NULL;
}
cloth_free_edgelist(edgelist, cloth->mvert_num);
-
+
if (cloth->edgeset) {
BLI_edgeset_free(cloth->edgeset);
cloth->edgeset = NULL;
@@ -979,10 +979,10 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd)
LinkNode *search = NULL;
float hair_frame[3][3], dir_old[3], dir_new[3];
int prev_mn; /* to find hair chains */
-
+
if (!clmd->hairdata)
return;
-
+
/* XXX Note: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
@@ -990,17 +990,17 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd)
* This messy situation can be resolved when solver data is
* generated directly from a dedicated hair system.
*/
-
+
prev_mn = -1;
for (search = cloth->springs; search; search = search->next) {
ClothSpring *spring = search->link;
ClothHairData *hair_ij, *hair_kl;
bool is_root = spring->kl != prev_mn;
-
+
if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) {
continue;
}
-
+
hair_ij = &clmd->hairdata[spring->ij];
hair_kl = &clmd->hairdata[spring->kl];
if (is_root) {
@@ -1011,39 +1011,39 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd)
*/
copy_v3_v3(dir_new, hair_frame[2]);
}
-
+
copy_v3_v3(dir_old, dir_new);
sub_v3_v3v3(dir_new, cloth->verts[spring->mn].x, cloth->verts[spring->kl].x);
normalize_v3(dir_new);
-
+
#if 0
if (clmd->debug_data && (spring->ij == 0 || spring->ij == 1)) {
float a[3], b[3];
-
+
copy_v3_v3(a, cloth->verts[spring->kl].x);
// BKE_sim_debug_data_add_dot(clmd->debug_data, cloth_vert ? cloth_vert->x : key->co, 1, 1, 0, "frames", 8246, p, k);
-
+
mul_v3_v3fl(b, hair_frame[0], clmd->sim_parms->avg_spring_len);
BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 1, 0, 0, "frames", 8247, spring->kl, spring->mn);
-
+
mul_v3_v3fl(b, hair_frame[1], clmd->sim_parms->avg_spring_len);
BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 1, 0, "frames", 8248, spring->kl, spring->mn);
-
+
mul_v3_v3fl(b, hair_frame[2], clmd->sim_parms->avg_spring_len);
BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 0, 1, "frames", 8249, spring->kl, spring->mn);
}
#endif
-
+
/* get local targets for kl/mn vertices by putting rest targets into the current frame,
* then multiply with the rest length to get the actual goals
*/
-
+
mul_v3_m3v3(spring->target, hair_frame, hair_kl->rest_target);
mul_v3_fl(spring->target, spring->restlen);
-
+
/* move frame to next hair segment */
cloth_parallel_transport_hair_frame(hair_frame, dir_old, dir_new);
-
+
prev_mn = spring->mn;
}
}
@@ -1054,10 +1054,10 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd)
LinkNode *search = NULL;
float hair_frame[3][3], dir_old[3], dir_new[3];
int prev_mn; /* to find hair roots */
-
+
if (!clmd->hairdata)
return;
-
+
/* XXX Note: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
@@ -1065,17 +1065,17 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd)
* This messy situation can be resolved when solver data is
* generated directly from a dedicated hair system.
*/
-
+
prev_mn = -1;
for (search = cloth->springs; search; search = search->next) {
ClothSpring *spring = search->link;
ClothHairData *hair_ij, *hair_kl;
bool is_root = spring->kl != prev_mn;
-
+
if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) {
continue;
}
-
+
hair_ij = &clmd->hairdata[spring->ij];
hair_kl = &clmd->hairdata[spring->kl];
if (is_root) {
@@ -1086,18 +1086,18 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd)
*/
copy_v3_v3(dir_new, hair_frame[2]);
}
-
+
copy_v3_v3(dir_old, dir_new);
sub_v3_v3v3(dir_new, cloth->verts[spring->mn].xrest, cloth->verts[spring->kl].xrest);
normalize_v3(dir_new);
-
+
/* dir expressed in the hair frame defines the rest target direction */
copy_v3_v3(hair_kl->rest_target, dir_new);
mul_transposed_m3_v3(hair_frame, hair_kl->rest_target);
-
+
/* move frame to next hair segment */
cloth_parallel_transport_hair_frame(hair_frame, dir_old, dir_new);
-
+
prev_mn = spring->mn;
}
}
@@ -1146,10 +1146,10 @@ static void cloth_update_springs( ClothModifierData *clmd )
spring->flags |= CLOTH_SPRING_FLAG_DEACTIVATE;
}
}
-
+
search = search->next;
}
-
+
cloth_hair_update_bending_targets(clmd);
}
@@ -1241,10 +1241,10 @@ BLI_INLINE void madd_m3_m3fl(float r[3][3], float m[3][3], float f)
void cloth_parallel_transport_hair_frame(float mat[3][3], const float dir_old[3], const float dir_new[3])
{
float rot[3][3];
-
+
/* rotation between segments */
rotation_between_vecs_to_mat3(rot, dir_old, dir_new);
-
+
/* rotate the frame */
mul_m3_m3m3(mat, rot, mat);
}
@@ -1266,7 +1266,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
LinkNodePair *edgelist;
EdgeSet *edgeset = NULL;
LinkNode *search = NULL, *search2 = NULL;
-
+
// error handling
if ( numedges==0 )
return 0;
@@ -1280,7 +1280,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->edgeset = NULL;
edgelist = MEM_callocN(sizeof(*edgelist) * mvert_num, "cloth_edgelist_alloc" );
-
+
if (!edgelist)
return 0;
@@ -1312,7 +1312,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->flags = 0;
struct_springs++;
-
+
BLI_linklist_prepend ( &cloth->springs, spring );
}
else {
@@ -1323,7 +1323,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if (struct_springs_real > 0)
clmd->sim_parms->avg_spring_len /= struct_springs_real;
-
+
for (i = 0; i < mvert_num; i++) {
if (cloth->verts[i].spring_count > 0)
cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count);
@@ -1413,15 +1413,15 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
while (search && search2) {
tspring = search->link;
tspring2 = search2->link;
-
+
if (tspring->ij == tspring2->kl) {
spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
-
+
if (!spring) {
cloth_free_errorsprings(cloth, edgelist);
return 0;
}
-
+
spring->ij = tspring2->ij;
spring->kl = tspring->ij;
spring->mn = tspring->kl;
@@ -1429,10 +1429,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->type = CLOTH_SPRING_TYPE_BENDING_ANG;
spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
bend_springs++;
-
+
BLI_linklist_prepend ( &cloth->springs, spring );
}
-
+
search = search->next;
search2 = search2->next;
}
@@ -1450,33 +1450,33 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
while (search && search2) {
tspring = search->link;
tspring2 = search2->link;
-
+
if (tspring->ij == tspring2->kl) {
spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
-
+
if (!spring) {
cloth_free_errorsprings(cloth, edgelist);
return 0;
}
-
+
spring->ij = tspring2->ij;
spring->kl = tspring->kl;
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
spring->type = CLOTH_SPRING_TYPE_BENDING;
spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
bend_springs++;
-
+
BLI_linklist_prepend ( &cloth->springs, spring );
}
-
+
search = search->next;
search2 = search2->next;
}
}
-
+
cloth_hair_update_bending_rest_targets(clmd);
}
-
+
/* note: the edges may already exist so run reinsert */
/* insert other near springs in edgeset AFTER bending springs are calculated (for selfcolls) */
@@ -1490,10 +1490,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
BLI_edgeset_add(edgeset, mloop[mpoly[i].loopstart + 1].v, mloop[mpoly[i].loopstart + 3].v);
}
}
-
-
+
+
cloth->numsprings = struct_springs + shear_springs + bend_springs;
-
+
cloth_free_edgelist(edgelist, mvert_num);
#if 0
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 65742df754e..b38d6b8bceb 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -444,7 +444,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
float v1[3], v2[3], relativeVelocity[3];
// calc relative velocity
-
+
// compute barycentric coordinates for both collision points
collision_compute_barycentric ( collpair->pa,
verts1[collpair->ap1].txold,
@@ -487,14 +487,14 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
/* only get objects with collision modifier */
if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision))
cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type);
-
+
if (cmd) {
/* extend array */
if (*numobj >= *maxobj) {
*maxobj *= 2;
*objs= MEM_reallocN(*objs, sizeof(Object *)*(*maxobj));
}
-
+
(*objs)[*numobj] = ob;
(*numobj)++;
}
@@ -511,7 +511,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
}
// return all collision objects in scene
-// collision object will exclude self
+// collision object will exclude self
Object **get_collisionobjects_ext(Scene *scene, Object *self, Group *group, int layer, unsigned int *numcollobj, unsigned int modifier_type, bool dupli)
{
Base *base;
@@ -519,7 +519,7 @@ Object **get_collisionobjects_ext(Scene *scene, Object *self, Group *group, int
GroupObject *go;
unsigned int numobj= 0, maxobj= 100;
int level = dupli ? 0 : 1;
-
+
objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
/* gather all collision objects */
@@ -560,7 +560,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
if (ob->pd && ob->pd->deflect)
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
-
+
if (cmd && cmd->bvhtree) {
if (*objs == NULL)
*objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
@@ -588,7 +588,7 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
{
GroupObject *go;
ListBase *objs= NULL;
-
+
/* add object in same layer in scene */
if (group) {
for (go= group->gobject.first; go; go= go->next)
@@ -623,7 +623,7 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap, double dt)
{
int i;
-
+
*collisions = (CollPair *) MEM_mallocN(sizeof(CollPair) * numresult * 4, "collision array" ); // * 4 since cloth_collision_static can return more than 1 collision
*collisions_index = *collisions;
@@ -640,10 +640,10 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
ClothVertex *verts = NULL;
int ret = 0;
int result = 0;
-
+
mvert_num = clmd->clothObject->mvert_num;
verts = cloth->verts;
-
+
// process all collisions (calculate impulses, TODO: also repulses if distance too short)
result = 1;
for ( j = 0; j < 2; j++ ) { /* 5 is just a value that ensures convergence */
@@ -689,7 +689,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh==NULL)
return 0;
-
+
verts = cloth->verts;
/* numfaces = cloth->numfaces; */ /* UNUSED */
mvert_num = cloth->mvert_num;
@@ -701,9 +701,9 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
// update cloth bvh
bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function)
bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function)
-
+
collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
-
+
if (!collobjs)
return 0;
@@ -721,31 +721,31 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
do {
CollPair **collisions, **collisions_index;
-
+
ret2 = 0;
collisions = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
-
+
// check all collision objects
for (i = 0; i < numcollobj; i++) {
Object *collob= collobjs[i];
CollisionModifierData *collmd = (CollisionModifierData *)modifiers_findByType(collob, eModifierType_Collision);
BVHTreeOverlap *overlap = NULL;
unsigned int result = 0;
-
+
if (!collmd->bvhtree)
continue;
-
+
/* search for overlapping collision pairs */
overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL);
-
+
// go to next object if no overlap is there
if ( result && overlap ) {
/* check if collisions really happen (costly near check) */
- cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i],
+ cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i],
&collisions_index[i], result, overlap, dt/(float)clmd->coll_parms->loop_count);
-
+
// resolve nearby collisions
ret += cloth_bvh_objcollisions_resolve ( clmd, collmd, collisions[i], collisions_index[i]);
ret2 += ret;
@@ -755,11 +755,11 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
MEM_freeN ( overlap );
}
rounds++;
-
+
for (i = 0; i < numcollobj; i++) {
if ( collisions[i] ) MEM_freeN ( collisions[i] );
}
-
+
MEM_freeN(collisions);
MEM_freeN(collisions_index);
@@ -779,8 +779,8 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
VECADD ( verts[i].tx, verts[i].txold, verts[i].tv );
}
////////////////////////////////////////////////////////////
-
-
+
+
////////////////////////////////////////////////////////////
// Test on *simple* selfcollisions
////////////////////////////////////////////////////////////
@@ -789,15 +789,15 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
/* TODO: add coll quality rounds again */
BVHTreeOverlap *overlap = NULL;
unsigned int result = 0;
-
+
// collisions = 1;
verts = cloth->verts; // needed for openMP
-
+
/* numfaces = cloth->numfaces; */ /* UNUSED */
mvert_num = cloth->mvert_num;
-
+
verts = cloth->verts;
-
+
if ( cloth->bvhselftree ) {
// search for overlapping collision pairs
overlap = BLI_bvhtree_overlap(cloth->bvhselftree, cloth->bvhselftree, &result, NULL, NULL);
@@ -807,12 +807,12 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
float temp[3];
float length = 0;
float mindistance;
-
+
i = overlap[k].indexA;
j = overlap[k].indexB;
-
+
mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
-
+
if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) {
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
@@ -826,20 +826,20 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
{
continue;
}
-
+
sub_v3_v3v3(temp, verts[i].tx, verts[j].tx);
-
+
if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
-
+
if (BLI_edgeset_haskey(cloth->edgeset, i, j)) {
continue;
}
-
+
length = normalize_v3(temp );
-
+
if ( length < mindistance ) {
float correction = mindistance - length;
-
+
if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) {
mul_v3_fl(temp, -correction);
VECADD ( verts[j].tx, verts[j].tx, temp );
@@ -851,7 +851,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
else {
mul_v3_fl(temp, correction * -0.5f);
VECADD ( verts[j].tx, verts[j].tx, temp );
-
+
sub_v3_v3v3(verts[i].tx, verts[i].tx, temp);
}
ret = 1;
@@ -861,10 +861,10 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
// check for approximated time collisions
}
}
-
+
if ( overlap )
MEM_freeN ( overlap );
-
+
}
}
////////////////////////////////////////////////////////////
@@ -883,7 +883,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
}
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
-
+
if (collobjs)
MEM_freeN(collobjs);
@@ -900,14 +900,14 @@ BLI_INLINE void max_v3_v3v3(float r[3], const float a[3], const float b[3])
void collision_get_collider_velocity(float vel_old[3], float vel_new[3], CollisionModifierData *collmd, CollPair *collpair)
{
float u1, u2, u3;
-
+
/* compute barycentric coordinates */
collision_compute_barycentric(collpair->pb,
collmd->current_x[collpair->bp1].co,
collmd->current_x[collpair->bp2].co,
collmd->current_x[collpair->bp3].co,
&u1, &u2, &u3);
-
+
collision_interpolateOnTriangle(vel_new, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3);
/* XXX assume constant velocity of the collider for now */
copy_v3_v3(vel_old, vel_new);
@@ -920,7 +920,7 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll
float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - pd->pdef_sbdamp);
float inv_dt = 1.0f / dt;
Cloth *cloth1 = clmd->clothObject;
-
+
// float w1, w2;
float u1, u2, u3;
float v1[3], v2_old[3], v2_new[3], v_rel_old[3], v_rel_new[3];
@@ -974,20 +974,20 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll
float v_nor_old, v_nor_new;
float v_tan_old[3], v_tan_new[3];
float bounce, repulse;
-
+
/* Collision response based on
* "Simulating Complex Hair with Robust Collision Handling" (Choe, Choi, Ko, ACM SIGGRAPH 2005)
* http://graphics.snu.ac.kr/publications/2005-choe-HairSim/Choe_2005_SCA.pdf
*/
-
+
v_nor_old = mag_v_rel;
v_nor_new = dot_v3v3(v_rel_new, collpair->normal);
-
+
madd_v3_v3v3fl(v_tan_old, v_rel_old, collpair->normal, -v_nor_old);
madd_v3_v3v3fl(v_tan_new, v_rel_new, collpair->normal, -v_nor_new);
-
+
repulse = -margin_distance * inv_dt + dot_v3v3(v1, collpair->normal);
-
+
if (margin_distance < -epsilon2) {
bounce = -v_nor_new + v_nor_old * restitution;
mul_v3_v3fl(impulse, collpair->normal, max_ff(repulse, bounce));
@@ -997,10 +997,10 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll
mul_v3_v3fl(impulse, collpair->normal, repulse);
}
cloth1->verts[collpair->ap1].impulse_count++;
-
+
result = true;
}
-
+
if (result) {
int i = 0;
@@ -1018,21 +1018,21 @@ BLI_INLINE bool cloth_point_face_collision_params(const float p1[3], const float
{
float edge1[3], edge2[3], p2face[3], p1p2[3], v0p2[3];
float nor_v0p2, nor_p1p2;
-
+
sub_v3_v3v3(edge1, v1, v0);
sub_v3_v3v3(edge2, v2, v0);
cross_v3_v3v3(r_nor, edge1, edge2);
normalize_v3(r_nor);
-
+
nor_v0p2 = dot_v3v3(v0p2, r_nor);
madd_v3_v3v3fl(p2face, p2, r_nor, -nor_v0p2);
interp_weights_tri_v3(r_w, v0, v1, v2, p2face);
-
+
sub_v3_v3v3(p1p2, p2, p1);
sub_v3_v3v3(v0p2, p2, v0);
nor_p1p2 = dot_v3v3(p1p2, r_nor);
*r_lambda = (nor_p1p2 != 0.0f ? nor_v0p2 / nor_p1p2 : 0.0f);
-
+
return r_w[1] >= 0.0f && r_w[2] >= 0.0f && r_w[1] + r_w[2] <= 1.0f;
#if 0 /* XXX this method uses the intersection point, but is broken and doesn't work well in general */
@@ -1089,7 +1089,7 @@ static CollPair *cloth_point_collpair(
if (!cloth_point_face_collision_params(p1, p2, co1, co2, co3, facenor, &lambda, w))
return collpair;
-
+
sub_v3_v3v3(v1p1, p1, co1);
// distance1 = dot_v3v3(v1p1, facenor);
sub_v3_v3v3(v1p2, p2, co1);
@@ -1097,7 +1097,7 @@ static CollPair *cloth_point_collpair(
// if (distance2 > epsilon || (distance1 < 0.0f && distance2 < 0.0f))
if (distance2 > epsilon)
return collpair;
-
+
collpair->face1 = index_cloth; /* XXX actually not a face, but equivalent index for point */
collpair->face2 = index_coll;
collpair->ap1 = index_cloth;
@@ -1105,20 +1105,20 @@ static CollPair *cloth_point_collpair(
collpair->bp1 = bp1;
collpair->bp2 = bp2;
collpair->bp3 = bp3;
-
+
/* note: using the second point here, which is
* the current updated position that needs to be corrected
*/
copy_v3_v3(collpair->pa, p2);
collpair->distance = distance2;
mul_v3_v3fl(collpair->vector, facenor, -distance2);
-
+
interp_v3_v3v3v3(collpair->pb, co1, co2, co3, w);
-
+
copy_v3_v3(collpair->normal, facenor);
collpair->time = lambda;
collpair->flag = 0;
-
+
collpair++;
return collpair;
}
@@ -1153,7 +1153,7 @@ static void cloth_points_objcollisions_nearcheck(
int numresult, BVHTreeOverlap *overlap, float epsilon, double dt)
{
int i;
-
+
/* can return 2 collisions in total */
*collisions = (CollPair *) MEM_mallocN(sizeof(CollPair) * numresult * 2, "collision array" );
*collisions_index = *collisions;
@@ -1172,11 +1172,11 @@ static int cloth_points_objcollisions_resolve(
int i = 0, mvert_num = clmd->clothObject->mvert_num;
ClothVertex *verts = cloth->verts;
int ret = 0;
-
+
// process all collisions
if ( collmd->bvhtree ) {
bool result = cloth_points_collision_response_static(clmd, collmd, pd, collisions, collisions_index, dt);
-
+
// apply impulses in parallel
if (result) {
for (i = 0; i < mvert_num; i++) {
@@ -1186,13 +1186,13 @@ static int cloth_points_objcollisions_resolve(
VECADD ( verts[i].tv, verts[i].tv, verts[i].impulse);
zero_v3(verts[i].impulse);
verts[i].impulse_count = 0;
-
+
ret++;
}
}
}
}
-
+
return ret;
}
@@ -1208,32 +1208,32 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
int ret = 0, ret2 = 0;
Object **collobjs = NULL;
unsigned int numcollobj = 0;
-
+
verts = cloth->verts;
mvert_num = cloth->mvert_num;
-
+
////////////////////////////////////////////////////////////
// static collisions
////////////////////////////////////////////////////////////
-
+
// create temporary cloth points bvh
cloth_bvh = BLI_bvhtree_new(mvert_num, max_ff(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel), 4, 6);
/* fill tree */
for (i = 0; i < mvert_num; i++) {
float co[2][3];
-
+
copy_v3_v3(co[0], verts[i].x);
copy_v3_v3(co[1], verts[i].tx);
-
+
BLI_bvhtree_insert(cloth_bvh, i, co[0], 2);
}
/* balance tree */
BLI_bvhtree_balance(cloth_bvh);
-
+
collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
if (!collobjs)
return 0;
-
+
/* move object to position (step) in time */
for (i = 0; i < numcollobj; i++) {
Object *collob= collobjs[i];
@@ -1247,12 +1247,12 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
do {
CollPair **collisions, **collisions_index;
-
+
ret2 = 0;
-
+
collisions = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
-
+
// check all collision objects
for (i = 0; i < numcollobj; i++) {
Object *collob= collobjs[i];
@@ -1260,35 +1260,35 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
BVHTreeOverlap *overlap = NULL;
unsigned int result = 0;
float epsilon;
-
+
if (!collmd->bvhtree)
continue;
-
+
/* search for overlapping collision pairs */
overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL);
epsilon = BLI_bvhtree_get_epsilon(collmd->bvhtree);
-
+
// go to next object if no overlap is there
if (result && overlap) {
/* check if collisions really happen (costly near check) */
cloth_points_objcollisions_nearcheck(clmd, collmd, &collisions[i], &collisions_index[i],
result, overlap, epsilon, round_dt);
-
+
// resolve nearby collisions
ret += cloth_points_objcollisions_resolve(clmd, collmd, collob->pd, collisions[i], collisions_index[i], round_dt);
ret2 += ret;
}
-
+
if (overlap)
MEM_freeN ( overlap );
}
rounds++;
-
+
for (i = 0; i < numcollobj; i++) {
if (collisions[i])
MEM_freeN(collisions[i]);
}
-
+
MEM_freeN(collisions);
MEM_freeN(collisions_index);
@@ -1310,7 +1310,7 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
////////////////////////////////////////////////////////////
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
-
+
if (collobjs)
MEM_freeN(collobjs);
@@ -1326,53 +1326,53 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step,
BVHTree *cloth_bvh;
unsigned int i = 0, mvert_num = 0;
ClothVertex *verts = NULL;
-
+
ColliderContacts *collider_contacts;
-
+
Object **collobjs = NULL;
unsigned int numcollobj = 0;
-
+
verts = cloth->verts;
mvert_num = cloth->mvert_num;
-
+
////////////////////////////////////////////////////////////
// static collisions
////////////////////////////////////////////////////////////
-
+
// create temporary cloth points bvh
cloth_bvh = BLI_bvhtree_new(mvert_num, max_ff(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel), 4, 6);
/* fill tree */
for (i = 0; i < mvert_num; i++) {
float co[6];
-
+
copy_v3_v3(&co[0*3], verts[i].x);
copy_v3_v3(&co[1*3], verts[i].tx);
-
+
BLI_bvhtree_insert(cloth_bvh, i, co, 2);
}
/* balance tree */
BLI_bvhtree_balance(cloth_bvh);
-
+
collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
if (!collobjs) {
*r_collider_contacts = NULL;
*r_totcolliders = 0;
return;
}
-
+
/* move object to position (step) in time */
for (i = 0; i < numcollobj; i++) {
Object *collob= collobjs[i];
CollisionModifierData *collmd = (CollisionModifierData *)modifiers_findByType(collob, eModifierType_Collision);
if (!collmd->bvhtree)
continue;
-
+
/* move object to position (step) in time */
collision_move_object ( collmd, step + dt, step );
}
-
+
collider_contacts = MEM_callocN(sizeof(ColliderContacts) * numcollobj, "CollPair");
-
+
// check all collision objects
for (i = 0; i < numcollobj; i++) {
ColliderContacts *ct = collider_contacts + i;
@@ -1381,46 +1381,46 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step,
BVHTreeOverlap *overlap;
unsigned int result = 0;
float epsilon;
-
+
ct->ob = collob;
ct->collmd = collmd;
ct->collisions = NULL;
ct->totcollisions = 0;
-
+
if (!collmd->bvhtree)
continue;
-
+
/* search for overlapping collision pairs */
overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL);
epsilon = BLI_bvhtree_get_epsilon(collmd->bvhtree);
-
+
// go to next object if no overlap is there
if (result && overlap) {
CollPair *collisions_index;
-
+
/* check if collisions really happen (costly near check) */
cloth_points_objcollisions_nearcheck(clmd, collmd, &ct->collisions, &collisions_index,
result, overlap, epsilon, dt);
ct->totcollisions = (int)(collisions_index - ct->collisions);
-
+
// resolve nearby collisions
// ret += cloth_points_objcollisions_resolve(clmd, collmd, collob->pd, collisions[i], collisions_index[i], dt);
}
-
+
if (overlap)
MEM_freeN(overlap);
}
-
+
if (collobjs)
MEM_freeN(collobjs);
BLI_bvhtree_free(cloth_bvh);
-
+
////////////////////////////////////////////////////////////
// update positions
// this is needed for bvh_calc_DOP_hull_moving() [kdop.c]
////////////////////////////////////////////////////////////
-
+
// verts come from clmd
for (i = 0; i < mvert_num; i++) {
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) {
@@ -1428,11 +1428,11 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step,
continue;
}
}
-
+
VECADD(verts[i].tx, verts[i].txold, verts[i].tv);
}
////////////////////////////////////////////////////////////
-
+
*r_collider_contacts = collider_contacts;
*r_totcolliders = numcollobj;
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 6c97380b9ca..ff4795afe87 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -62,21 +62,21 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m
{
int a;
float clipminx, clipminy, clipmaxx, clipmaxy;
-
+
cumap->flag = CUMA_DO_CLIP;
if (tot == 4) cumap->cur = 3; /* rhms, hack for 'col' curve? */
-
+
clipminx = min_ff(minx, maxx);
clipminy = min_ff(miny, maxy);
clipmaxx = max_ff(minx, maxx);
clipmaxy = max_ff(miny, maxy);
-
+
BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
cumap->clipr = cumap->curr;
-
+
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
cumap->bwmul[0] = cumap->bwmul[1] = cumap->bwmul[2] = 1.0f;
-
+
for (a = 0; a < tot; a++) {
cumap->cm[a].flag = CUMA_EXTEND_EXTRAPOLATE;
cumap->cm[a].totpoint = 2;
@@ -187,7 +187,7 @@ bool curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
{
CurveMapPoint *cmp;
int a, b, removed = 0;
-
+
/* must have 2 points minimum */
if (cuma->totpoint <= 2)
return false;
@@ -204,7 +204,7 @@ bool curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
removed++;
}
}
-
+
MEM_freeN(cuma->curve);
cuma->curve = cmp;
cuma->totpoint -= removed;
@@ -216,7 +216,7 @@ void curvemap_remove(CurveMap *cuma, const short flag)
{
CurveMapPoint *cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points");
int a, b, removed = 0;
-
+
/* well, lets keep the two outer points! */
cmp[0] = cuma->curve[0];
for (a = 1, b = 1; a < cuma->totpoint - 1; a++) {
@@ -229,7 +229,7 @@ void curvemap_remove(CurveMap *cuma, const short flag)
}
}
cmp[b] = cuma->curve[a];
-
+
MEM_freeN(cuma->curve);
cuma->curve = cmp;
cuma->totpoint -= removed;
@@ -359,11 +359,11 @@ void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope)
if (slope == CURVEMAP_SLOPE_POSITIVE) {
int i, last = cuma->totpoint - 1;
CurveMapPoint *newpoints = MEM_dupallocN(cuma->curve);
-
+
for (i = 0; i < cuma->totpoint; i++) {
newpoints[i].y = cuma->curve[last - i].y;
}
-
+
MEM_freeN(cuma->curve);
cuma->curve = newpoints;
}
@@ -397,7 +397,7 @@ void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope)
void curvemap_handle_set(CurveMap *cuma, int type)
{
int a;
-
+
for (a = 0; a < cuma->totpoint; a++) {
if (cuma->curve[a].flag & CUMA_SELECT) {
cuma->curve[a].flag &= ~(CUMA_HANDLE_VECTOR | CUMA_HANDLE_AUTO_ANIM);
@@ -435,9 +435,9 @@ static void calchandle_curvemap(
if (bezt->h1 == 0 && bezt->h2 == 0) {
return;
}
-
+
p2 = bezt->vec[1];
-
+
if (prev == NULL) {
p3 = next->vec[1];
pt[0] = 2.0f * p2[0] - p3[0];
@@ -447,7 +447,7 @@ static void calchandle_curvemap(
else {
p1 = prev->vec[1];
}
-
+
if (next == NULL) {
p1 = prev->vec[1];
pt[0] = 2.0f * p2[0] - p1[0];
@@ -474,7 +474,7 @@ static void calchandle_curvemap(
len = len_v2(tvec) * 2.5614f;
if (len != 0.0f) {
-
+
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {
len_a /= len;
madd_v2_v2v2fl(p2_h1, p2, tvec, -len_a);
@@ -541,7 +541,7 @@ static void calchandle_curvemap(
#undef p2_h2
}
-/* in X, out Y.
+/* in X, out Y.
* X is presumed to be outside first or last */
static float curvemap_calc_extend(const CurveMap *cuma, float x, const float first[2], const float last[2])
{
@@ -579,16 +579,16 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
BezTriple *bezt;
float *fp, *allpoints, *lastpoint, curf, range;
int a, totpoint;
-
+
if (cuma->curve == NULL) return;
-
+
/* default rect also is table range */
cuma->mintable = clipr->xmin;
cuma->maxtable = clipr->xmax;
-
+
/* hrmf... we now rely on blender ipo beziers, these are more advanced */
bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr");
-
+
for (a = 0; a < cuma->totpoint; a++) {
cuma->mintable = min_ff(cuma->mintable, cmp[a].x);
cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x);
@@ -604,27 +604,27 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
bezt[a].h1 = bezt[a].h2 = HD_AUTO;
}
}
-
+
const BezTriple *bezt_prev = NULL;
for (a = 0; a < cuma->totpoint; a++) {
const BezTriple *bezt_next = (a != cuma->totpoint - 1) ? &bezt[a + 1] : NULL;
calchandle_curvemap(&bezt[a], bezt_prev, bezt_next);
bezt_prev = &bezt[a];
}
-
- /* first and last handle need correction, instead of pointing to center of next/prev,
+
+ /* first and last handle need correction, instead of pointing to center of next/prev,
* we let it point to the closest handle */
if (cuma->totpoint > 2) {
float hlen, nlen, vec[3];
-
+
if (bezt[0].h2 == HD_AUTO) {
-
+
hlen = len_v3v3(bezt[0].vec[1], bezt[0].vec[2]); /* original handle length */
/* clip handle point */
copy_v3_v3(vec, bezt[1].vec[0]);
if (vec[0] < bezt[0].vec[1][0])
vec[0] = bezt[0].vec[1][0];
-
+
sub_v3_v3(vec, bezt[0].vec[1]);
nlen = len_v3(vec);
if (nlen > FLT_EPSILON) {
@@ -635,13 +635,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
}
a = cuma->totpoint - 1;
if (bezt[a].h2 == HD_AUTO) {
-
+
hlen = len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */
/* clip handle point */
copy_v3_v3(vec, bezt[a - 1].vec[2]);
if (vec[0] > bezt[a].vec[1][0])
vec[0] = bezt[a].vec[1][0];
-
+
sub_v3_v3(vec, bezt[a].vec[1]);
nlen = len_v3(vec);
if (nlen > FLT_EPSILON) {
@@ -656,13 +656,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
MEM_freeN(cuma->table);
totpoint = (cuma->totpoint - 1) * CM_RESOL;
fp = allpoints = MEM_callocN(totpoint * 2 * sizeof(float), "table");
-
+
for (a = 0; a < cuma->totpoint - 1; a++, fp += 2 * CM_RESOL) {
correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a + 1].vec[0], bezt[a + 1].vec[1]);
BKE_curve_forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a + 1].vec[0][0], bezt[a + 1].vec[1][0], fp, CM_RESOL - 1, 2 * sizeof(float));
BKE_curve_forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a + 1].vec[0][1], bezt[a + 1].vec[1][1], fp + 1, CM_RESOL - 1, 2 * sizeof(float));
}
-
+
/* store first and last handle for extrapolation, unit length */
cuma->ext_in[0] = bezt[0].vec[0][0] - bezt[0].vec[1][0];
cuma->ext_in[1] = bezt[0].vec[0][1] - bezt[0].vec[1][1];
@@ -676,13 +676,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]);
cuma->ext_out[0] /= range;
cuma->ext_out[1] /= range;
-
+
/* cleanup */
MEM_freeN(bezt);
range = CM_TABLEDIV * (cuma->maxtable - cuma->mintable);
cuma->range = 1.0f / range;
-
+
/* now make a table with CM_TABLE equal x distances */
fp = allpoints;
lastpoint = allpoints + 2 * (totpoint - 1);
@@ -691,7 +691,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
for (a = 0; a <= CM_TABLE; a++) {
curf = cuma->mintable + range * (float)a;
cmp[a].x = curf;
-
+
/* get the first x coordinate larger than curf */
while (curf >= fp[0] && fp != lastpoint) {
fp += 2;
@@ -708,7 +708,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
cmp[a].y = fac1 * fp[-1] + (1.0f - fac1) * fp[1];
}
}
-
+
MEM_freeN(allpoints);
cuma->table = cmp;
}
@@ -718,7 +718,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
void curvemapping_premultiply(CurveMapping *cumap, int restore)
{
int a;
-
+
if (restore) {
if (cumap->flag & CUMA_PREMULLED) {
for (a = 0; a < 3; a++) {
@@ -731,7 +731,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
zero_v2(cumap->cm[a].premul_ext_in);
zero_v2(cumap->cm[a].premul_ext_out);
}
-
+
cumap->flag &= ~CUMA_PREMULLED;
}
}
@@ -745,10 +745,10 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
cumap->cm[a].table = MEM_mallocN((CM_TABLE + 1) * sizeof(CurveMapPoint), "premul table");
memcpy(cumap->cm[a].table, cumap->cm[a].premultable, (CM_TABLE + 1) * sizeof(CurveMapPoint));
}
-
+
if (cumap->cm[3].table == NULL)
curvemap_make_table(cumap->cm + 3, &cumap->clipr);
-
+
/* premul */
for (a = 0; a < 3; a++) {
int b;
@@ -761,7 +761,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
mul_v2_v2(cumap->cm[a].ext_in, cumap->cm[3].ext_in);
mul_v2_v2(cumap->cm[a].ext_out, cumap->cm[3].ext_out);
}
-
+
cumap->flag |= CUMA_PREMULLED;
}
}
@@ -770,7 +770,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
static int sort_curvepoints(const void *a1, const void *a2)
{
const struct CurveMapPoint *x1 = a1, *x2 = a2;
-
+
if (x1->x > x2->x) return 1;
else if (x1->x < x2->x) return -1;
return 0;
@@ -821,10 +821,10 @@ void curvemapping_changed(CurveMapping *cumap, const bool rem_doubles)
cumap->curr.ymax = cumap->clipr.ymax;
}
}
-
-
+
+
qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints);
-
+
/* remove doubles, threshold set on 1% of default range */
if (rem_doubles && cuma->totpoint > 2) {
for (a = 0; a < cuma->totpoint - 1; a++) {
@@ -873,14 +873,14 @@ float curvemap_evaluateF(const CurveMap *cuma, float value)
/* index in table */
fi = (value - cuma->mintable) * cuma->range;
i = (int)fi;
-
+
/* fi is table float index and should check against table range i.e. [0.0 CM_TABLE] */
if (fi < 0.0f || fi > CM_TABLE)
return curvemap_calc_extend(cuma, value, &cuma->table[0].x, &cuma->table[CM_TABLE].x);
else {
if (i < 0) return cuma->table[0].y;
if (i >= CM_TABLE) return cuma->table[CM_TABLE].y;
-
+
fi = fi - (float)i;
return (1.0f - fi) * cuma->table[i].y + (fi) * cuma->table[i + 1].y;
}
@@ -963,18 +963,18 @@ void curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char ve
int curvemapping_RGBA_does_something(const CurveMapping *cumap)
{
int a;
-
+
if (cumap->black[0] != 0.0f) return 1;
if (cumap->black[1] != 0.0f) return 1;
if (cumap->black[2] != 0.0f) return 1;
if (cumap->white[0] != 1.0f) return 1;
if (cumap->white[1] != 1.0f) return 1;
if (cumap->white[2] != 1.0f) return 1;
-
+
for (a = 0; a < CM_TOT; a++) {
if (cumap->cm[a].curve) {
if (cumap->cm[a].totpoint != 2) return 1;
-
+
if (cumap->cm[a].curve[0].x != 0.0f) return 1;
if (cumap->cm[a].curve[0].y != 0.0f) return 1;
if (cumap->cm[a].curve[1].x != 1.0f) return 1;
@@ -987,9 +987,9 @@ int curvemapping_RGBA_does_something(const CurveMapping *cumap)
void curvemapping_initialize(CurveMapping *cumap)
{
int a;
-
+
if (cumap == NULL) return;
-
+
for (a = 0; a < CM_TOT; a++) {
if (cumap->cm[a].table == NULL)
curvemap_make_table(cumap->cm + a, &cumap->clipr);
@@ -999,7 +999,7 @@ void curvemapping_initialize(CurveMapping *cumap)
void curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size)
{
int a;
-
+
*size = CM_TABLE + 1;
*array = MEM_callocN(sizeof(float) * (*size) * 4, "CurveMapping");
@@ -1165,7 +1165,7 @@ typedef struct ScopesUpdateDataChunk {
float min[3], max[3];
} ScopesUpdateDataChunk;
-static void scopes_update_cb(void *__restrict userdata,
+static void scopes_update_cb(void *__restrict userdata,
const int y,
const ParallelRangeTLS *__restrict tls)
{
@@ -1347,7 +1347,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
/* convert to number of lines with logarithmic scale */
scopes->sample_lines = (scopes->accuracy * 0.01f) * (scopes->accuracy * 0.01f) * ibuf->y;
CLAMP_MIN(scopes->sample_lines, 1);
-
+
if (scopes->sample_full)
scopes->sample_lines = ibuf->y;
@@ -1356,9 +1356,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
scopes->minmax[a][0] = 25500.0f;
scopes->minmax[a][1] = -25500.0f;
}
-
+
scopes->waveform_tot = ibuf->x * scopes->sample_lines;
-
+
if (scopes->waveform_1)
MEM_freeN(scopes->waveform_1);
if (scopes->waveform_2)
@@ -1367,12 +1367,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
MEM_freeN(scopes->waveform_3);
if (scopes->vecscope)
MEM_freeN(scopes->vecscope);
-
+
scopes->waveform_1 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 1");
scopes->waveform_2 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 2");
scopes->waveform_3 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 3");
scopes->vecscope = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "vectorscope point channel");
-
+
if (ibuf->rect_float) {
cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
}
@@ -1411,7 +1411,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
bin_a[a] = sqrt(bin_a[a]);
}
#endif
-
+
/* convert hist data to float (proportional to max count) */
nl = na = nr = nb = ng = 0;
for (a = 0; a < 256; a++) {
@@ -1426,7 +1426,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
divr = nr ? 1.0 / (double)nr : 1.0;
divg = ng ? 1.0 / (double)ng : 1.0;
divb = nb ? 1.0 / (double)nb : 1.0;
-
+
for (a = 0; a < 256; a++) {
scopes->hist.data_luma[a] = bin_lum[a] * divl;
scopes->hist.data_r[a] = bin_r[a] * divr;
@@ -1439,7 +1439,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
IMB_colormanagement_processor_free(cm_processor);
if (cache_handle)
IMB_display_buffer_release(cache_handle);
-
+
scopes->ok = 1;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 25a77821dd2..2a5a0cf9ae7 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -30,7 +30,7 @@
*/
-#include <stdio.h>
+#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <math.h>
@@ -124,13 +124,13 @@ void BKE_constraint_unique_name(bConstraint *con, ListBase *list)
bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subdata, short datatype)
{
bConstraintOb *cob;
-
+
/* create regardless of whether we have any data! */
cob = MEM_callocN(sizeof(bConstraintOb), "bConstraintOb");
-
+
/* for system time, part of deglobalization, code nicer later with local time (ton) */
cob->scene = scene;
-
+
/* based on type of available data */
switch (datatype) {
case CONSTRAINT_OBTYPE_OBJECT:
@@ -139,7 +139,7 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
if (ob) {
cob->ob = ob;
cob->type = datatype;
-
+
if (cob->ob->rotmode > 0) {
/* Should be some kind of Euler order, so use it */
/* NOTE: Versions <= 2.76 assumed that "default" order
@@ -157,7 +157,7 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
}
else
unit_m4(cob->matrix);
-
+
copy_m4_m4(cob->startmat, cob->matrix);
break;
}
@@ -168,7 +168,7 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
cob->ob = ob;
cob->pchan = (bPoseChannel *)subdata;
cob->type = datatype;
-
+
if (cob->pchan->rotmode > 0) {
/* should be some type of Euler order */
cob->rotOrder = cob->pchan->rotmode;
@@ -177,13 +177,13 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
/* Quats, so eulers should just use default order */
cob->rotOrder = EULER_ORDER_DEFAULT;
}
-
+
/* matrix in world-space */
mul_m4_m4m4(cob->matrix, ob->obmat, cob->pchan->pose_mat);
}
else
unit_m4(cob->matrix);
-
+
copy_m4_m4(cob->startmat, cob->matrix);
break;
}
@@ -200,11 +200,11 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda
void BKE_constraints_clear_evalob(bConstraintOb *cob)
{
float delta[4][4], imat[4][4];
-
+
/* prevent crashes */
- if (cob == NULL)
+ if (cob == NULL)
return;
-
+
/* calculate delta of constraints evaluation */
invert_m4_m4(imat, cob->startmat);
/* XXX This would seem to be in wrong order. However, it does not work in 'right' order - would be nice to
@@ -212,7 +212,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
* In any case, we **do not get a delta** here (e.g. startmat & matrix having same location, still gives
* a 'delta' with non-null translation component :/ ).*/
mul_m4_m4m4(delta, cob->matrix, imat);
-
+
/* copy matrices back to source */
switch (cob->type) {
case CONSTRAINT_OBTYPE_OBJECT:
@@ -221,7 +221,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
if (cob->ob) {
/* copy new ob-matrix back to owner */
copy_m4_m4(cob->ob->obmat, cob->matrix);
-
+
/* copy inverse of delta back to owner */
invert_m4_m4(cob->ob->constinv, delta);
}
@@ -233,21 +233,21 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
if (cob->ob && cob->pchan) {
/* copy new pose-matrix back to owner */
mul_m4_m4m4(cob->pchan->pose_mat, cob->ob->imat, cob->matrix);
-
+
/* copy inverse of delta back to owner */
invert_m4_m4(cob->pchan->constinv, delta);
}
break;
}
}
-
+
/* free tempolary struct */
MEM_freeN(cob);
}
/* -------------- Space-Conversion API -------------- */
-/* This function is responsible for the correct transformations/conversions
+/* This function is responsible for the correct transformations/conversions
* of a matrix from one space to another for constraint evaluation.
* For now, this is only implemented for Objects and PoseChannels.
*/
@@ -256,12 +256,12 @@ void BKE_constraint_mat_convertspace(
{
float diff_mat[4][4];
float imat[4][4];
-
+
/* prevent crashes in these unlikely events */
if (ob == NULL || mat == NULL) return;
/* optimize trick - check if need to do anything */
if (from == to) return;
-
+
/* are we dealing with pose-channels or objects */
if (pchan) {
/* pose channels */
@@ -271,7 +271,7 @@ void BKE_constraint_mat_convertspace(
/* world to pose */
invert_m4_m4(imat, ob->obmat);
mul_m4_m4m4(mat, imat, mat);
-
+
/* use pose-space as stepping stone for other spaces... */
if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) {
/* call self with slightly different values */
@@ -307,7 +307,7 @@ void BKE_constraint_mat_convertspace(
/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
BKE_armature_mat_bone_to_pose(pchan, mat, mat);
}
-
+
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL)) {
/* call self with slightly different values */
@@ -322,7 +322,7 @@ void BKE_constraint_mat_convertspace(
copy_m4_m4(diff_mat, pchan->bone->arm_mat);
mul_m4_m4m4(mat, mat, diff_mat);
}
-
+
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL)) {
/* call self with slightly different values */
@@ -343,7 +343,7 @@ void BKE_constraint_mat_convertspace(
mul_m4_m4m4(mat, imat, mat);
}
else {
- /* Local space in this case will have to be defined as local to the owner's
+ /* Local space in this case will have to be defined as local to the owner's
* transform-property-rotated axes. So subtract this rotation component.
*/
/* XXX This is actually an ugly hack, local space of a parent-less object *is* the same as
@@ -358,7 +358,7 @@ void BKE_constraint_mat_convertspace(
normalize_m4(diff_mat);
}
zero_v3(diff_mat[3]);
-
+
invert_m4_m4_safe(imat, diff_mat);
mul_m4_m4m4(mat, imat, mat);
}
@@ -371,7 +371,7 @@ void BKE_constraint_mat_convertspace(
mul_m4_m4m4(mat, diff_mat, mat);
}
else {
- /* Local space in this case will have to be defined as local to the owner's
+ /* Local space in this case will have to be defined as local to the owner's
* transform-property-rotated axes. So add back this rotation component.
*/
/* XXX See comment above for world->local case... */
@@ -380,7 +380,7 @@ void BKE_constraint_mat_convertspace(
normalize_m4(diff_mat);
}
zero_v3(diff_mat[3]);
-
+
mul_m4_m4m4(mat, diff_mat, mat);
}
}
@@ -399,10 +399,10 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
float imat[3][3], tmat[3][3];
const int defgroup = defgroup_name_index(ob, substring);
short freeDM = 0;
-
+
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
-
+
/* get index of vertex group */
if (defgroup == -1) return;
@@ -414,18 +414,18 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
}
else {
/* when not in EditMode, use the 'final' derived mesh, depsgraph
- * ensures we build with CD_MDEFORMVERT layer
+ * ensures we build with CD_MDEFORMVERT layer
*/
dm = (DerivedMesh *)ob->derivedFinal;
}
-
+
/* only continue if there's a valid DerivedMesh */
if (dm) {
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
int numVerts = dm->getNumVerts(dm);
int i;
float co[3], nor[3];
-
+
/* check that dvert is a valid pointers (just in case) */
if (dvert) {
MDeformVert *dv = dvert;
@@ -449,22 +449,22 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
mul_v3_fl(vec, 1.0f / weightsum);
mul_v3_fl(normal, 1.0f / weightsum);
}
-
-
- /* derive the rotation from the average normal:
- * - code taken from transform_manipulator.c,
+
+
+ /* derive the rotation from the average normal:
+ * - code taken from transform_manipulator.c,
* calc_manipulator_stats, V3D_MANIP_NORMAL case
*/
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
-
+
invert_m3_m3(tmat, imat);
transpose_m3(tmat);
mul_m3_v3(tmat, normal);
-
+
normalize_v3(normal);
copy_v3_v3(plane, tmat[1]);
-
+
cross_v3_v3v3(mat[0], normal, plane);
if (len_squared_v3(mat[0]) < SQUARE(1e-3f)) {
copy_v3_v3(plane, tmat[0]);
@@ -476,12 +476,12 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
normalize_m4(mat);
-
+
/* apply the average coordinate as the new location */
mul_v3_m4v3(mat[3], ob->obmat, vec);
}
}
-
+
/* free temporary DerivedMesh created (in EditMode case) */
if (dm && freeDM)
dm->release(dm);
@@ -491,25 +491,25 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
static void contarget_get_lattice_mat(Object *ob, const char *substring, float mat[4][4])
{
Lattice *lt = (Lattice *)ob->data;
-
+
DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
const float *co = dl ? dl->verts : NULL;
BPoint *bp = lt->def;
-
+
MDeformVert *dv = lt->dvert;
int tot_verts = lt->pntsu * lt->pntsv * lt->pntsw;
float vec[3] = {0.0f, 0.0f, 0.0f}, tvec[3];
int grouped = 0;
int i, n;
const int defgroup = defgroup_name_index(ob, substring);
-
+
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
/* get index of vertex group */
if (defgroup == -1) return;
if (dv == NULL) return;
-
+
/* 1. Loop through control-points checking if in nominated vertex-group.
* 2. If it is, add it to vec to find the average point.
*/
@@ -524,17 +524,17 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
grouped++;
}
}
-
+
/* advance pointer to coordinate data */
if (co) co += 3;
else bp++;
}
-
+
/* find average location, then multiply by ob->obmat to find world-space location */
if (grouped)
mul_v3_fl(vec, 1.0f / grouped);
mul_v3_m4v3(tvec, ob->obmat, vec);
-
+
/* copy new location to matrix */
copy_v3_v3(mat[3], tvec);
}
@@ -550,7 +550,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
}
/* Case VERTEXGROUP */
/* Current method just takes the average location of all the points in the
- * VertexGroup, and uses that as the location value of the targets. Where
+ * VertexGroup, and uses that as the location value of the targets. Where
* possible, the orientation will also be calculated, by calculating an
* 'average' vertex normal, and deriving the rotation from that.
*
@@ -568,7 +568,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
/* Case BONE */
else {
bPoseChannel *pchan;
-
+
pchan = BKE_pose_channel_find_name(ob->pose, substring);
if (pchan) {
/* Multiply the PoseSpace accumulation/final matrix for this
@@ -584,22 +584,22 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
Mat4 bbone[MAX_BBONE_SUBDIV];
float tempmat[4][4];
float loc[3], fac;
-
+
/* get bbone segments */
b_bone_spline_setup(pchan, 0, bbone);
-
+
/* figure out which segment(s) the headtail value falls in */
fac = (float)pchan->bone->segments * headtail;
-
+
if (fac >= pchan->bone->segments - 1) {
/* special case: end segment doesn't get created properly... */
float pt[3], sfac;
int index;
-
+
/* bbone points are in bonespace, so need to move to posespace first */
index = pchan->bone->segments - 1;
mul_v3_m4v3(pt, pchan->pose_mat, bbone[index].mat[3]);
-
+
/* interpolate between last segment point and the endpoint */
sfac = fac - (float)(pchan->bone->segments - 1); /* fac is just the "leftover" between penultimate and last points */
interp_v3_v3v3(loc, pt, pchan->pose_tail, sfac);
@@ -608,45 +608,45 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
/* get indices for finding interpolating between points along the bbone */
float pt_a[3], pt_b[3], pt[3];
int index_a, index_b;
-
+
index_a = floorf(fac);
CLAMP(index_a, 0, MAX_BBONE_SUBDIV - 1);
-
+
index_b = ceilf(fac);
CLAMP(index_b, 0, MAX_BBONE_SUBDIV - 1);
-
+
/* interpolate between these points */
copy_v3_v3(pt_a, bbone[index_a].mat[3]);
copy_v3_v3(pt_b, bbone[index_b].mat[3]);
-
+
interp_v3_v3v3(pt, pt_a, pt_b, fac - floorf(fac));
-
+
/* move the point from bone local space to pose space... */
mul_v3_m4v3(loc, pchan->pose_mat, pt);
}
-
+
/* use interpolated distance for subtarget */
copy_m4_m4(tempmat, pchan->pose_mat);
copy_v3_v3(tempmat[3], loc);
-
+
mul_m4_m4m4(mat, ob->obmat, tempmat);
}
else {
float tempmat[4][4], loc[3];
-
+
/* interpolate along length of bone */
interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail);
-
+
/* use interpolated distance for subtarget */
copy_m4_m4(tempmat, pchan->pose_mat);
copy_v3_v3(tempmat[3], loc);
-
+
mul_m4_m4m4(mat, ob->obmat, tempmat);
}
}
else
copy_m4_m4(mat, ob->obmat);
-
+
/* convert matrix space as required */
BKE_constraint_mat_convertspace(ob, pchan, mat, from, to, false);
}
@@ -657,7 +657,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
* times. In addition to this, each constraint should have a type-info struct, where
* its functions are attached for use.
*/
-
+
/* Template for type-info data:
* - make a copy of this when creating new constraints, and just change the functions
* pointed to as necessary
@@ -686,7 +686,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = {
};
#endif
-/* This function should be used for the get_target_matrix member of all
+/* This function should be used for the get_target_matrix member of all
* constraints that are not picky about what happens to their target matrix.
*/
static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime))
@@ -697,7 +697,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo
unit_m4(ct->matrix);
}
-/* This following macro should be used for all standard single-target *_get_tars functions
+/* This following macro should be used for all standard single-target *_get_tars functions
* to save typing and reduce maintenance woes.
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
@@ -730,8 +730,8 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo
\
BLI_addtail(list, ct); \
} (void)0
-
-/* This following macro should be used for all standard single-target *_get_tars functions
+
+/* This following macro should be used for all standard single-target *_get_tars functions
* to save typing and reduce maintenance woes. It does not do the subtarget related operations
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
@@ -770,7 +770,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo
ct = ctn; \
} \
} (void)0
-
+
/* This following macro should be used for all standard single-target *_flush_tars functions
* to save typing and reduce maintenance woes. It does not do the subtarget related operations.
* Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
@@ -796,7 +796,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo
static void childof_new_data(void *cdata)
{
bChildOfConstraint *data = (bChildOfConstraint *)cdata;
-
+
data->flag = (CHILDOF_LOCX | CHILDOF_LOCY | CHILDOF_LOCZ |
CHILDOF_ROTX | CHILDOF_ROTY | CHILDOF_ROTZ |
CHILDOF_SIZEX | CHILDOF_SIZEY | CHILDOF_SIZEZ);
@@ -806,7 +806,7 @@ static void childof_new_data(void *cdata)
static void childof_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bChildOfConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -816,13 +816,13 @@ static int childof_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bChildOfConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -831,7 +831,7 @@ static void childof_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bChildOfConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -845,16 +845,16 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float parmat[4][4];
-
+
/* simple matrix parenting */
if (data->flag == CHILDOF_ALL) {
-
- /* multiply target (parent matrix) by offset (parent inverse) to get
+
+ /* multiply target (parent matrix) by offset (parent inverse) to get
* the effect of the parent that will be exerted on the owner
*/
mul_m4_m4m4(parmat, ct->matrix, data->invmat);
-
- /* now multiply the parent matrix by the owner matrix to get the
+
+ /* now multiply the parent matrix by the owner matrix to get the
* the effect of this constraint (i.e. owner is 'parented' to parent)
*/
mul_m4_m4m4(cob->matrix, parmat, cob->matrix);
@@ -863,19 +863,19 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
float invmat[4][4], tempmat[4][4];
float loc[3], eul[3], size[3];
float loco[3], eulo[3], sizo[3];
-
+
/* get offset (parent-inverse) matrix */
copy_m4_m4(invmat, data->invmat);
-
+
/* extract components of both matrices */
copy_v3_v3(loc, ct->matrix[3]);
mat4_to_eulO(eul, ct->rotOrder, ct->matrix);
mat4_to_size(size, ct->matrix);
-
+
copy_v3_v3(loco, invmat[3]);
mat4_to_eulO(eulo, cob->rotOrder, invmat);
mat4_to_size(sizo, invmat);
-
+
/* disable channels not enabled */
if (!(data->flag & CHILDOF_LOCX)) loc[0] = loco[0] = 0.0f;
if (!(data->flag & CHILDOF_LOCY)) loc[1] = loco[1] = 0.0f;
@@ -886,22 +886,22 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
if (!(data->flag & CHILDOF_SIZEX)) size[0] = sizo[0] = 1.0f;
if (!(data->flag & CHILDOF_SIZEY)) size[1] = sizo[1] = 1.0f;
if (!(data->flag & CHILDOF_SIZEZ)) size[2] = sizo[2] = 1.0f;
-
+
/* make new target mat and offset mat */
loc_eulO_size_to_mat4(ct->matrix, loc, eul, size, ct->rotOrder);
loc_eulO_size_to_mat4(invmat, loco, eulo, sizo, cob->rotOrder);
-
- /* multiply target (parent matrix) by offset (parent inverse) to get
+
+ /* multiply target (parent matrix) by offset (parent inverse) to get
* the effect of the parent that will be exerted on the owner
*/
mul_m4_m4m4(parmat, ct->matrix, invmat);
-
- /* now multiply the parent matrix by the owner matrix to get the
+
+ /* now multiply the parent matrix by the owner matrix to get the
* the effect of this constraint (i.e. owner is 'parented' to parent)
*/
copy_m4_m4(tempmat, cob->matrix);
mul_m4_m4m4(cob->matrix, parmat, tempmat);
-
+
/* without this, changes to scale and rotation can change location
* of a parentless bone or a disconnected bone. Even though its set
* to zero above. */
@@ -933,15 +933,15 @@ static bConstraintTypeInfo CTI_CHILDOF = {
static void trackto_new_data(void *cdata)
{
bTrackToConstraint *data = (bTrackToConstraint *)cdata;
-
+
data->reserved1 = TRACK_Y;
data->reserved2 = UP_Z;
-}
+}
static void trackto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bTrackToConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -951,13 +951,13 @@ static int trackto_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bTrackToConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -966,7 +966,7 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bTrackToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -976,14 +976,14 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
static int basis_cross(int n, int m)
{
switch (n - m) {
- case 1:
+ case 1:
case -2:
return 1;
-
- case -1:
+
+ case -1:
case 2:
return -1;
-
+
default:
return 0;
}
@@ -1039,14 +1039,14 @@ static void vectomat(const float vec[3], const float target_up[3], short axis, s
if (axis != upflag) {
right_index = 3 - axis - upflag;
neg = (float)basis_cross(axis, upflag);
-
+
/* account for up direction, track direction */
m[right_index][0] = neg * right[0];
m[right_index][1] = neg * right[1];
m[right_index][2] = neg * right[2];
-
+
copy_v3_v3(m[upflag], proj);
-
+
copy_v3_v3(m[axis], n);
}
/* identity matrix - don't do anything if the two axes are the same */
@@ -1060,14 +1060,14 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
{
bTrackToConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float size[3], vec[3];
float totmat[3][3];
-
+
/* Get size property, since ob->size is only the object's own relative size, not its global one */
mat4_to_size(size, cob->matrix);
-
+
/* Clear the object's rotation */
cob->matrix[0][0] = size[0];
cob->matrix[0][1] = 0;
@@ -1078,12 +1078,12 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
cob->matrix[2][0] = 0;
cob->matrix[2][1] = 0;
cob->matrix[2][2] = size[2];
-
+
/* targetmat[2] instead of ownermat[2] is passed to vectomat
* for backwards compatibility it seems... (Aligorith)
*/
sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
- vectomat(vec, ct->matrix[2],
+ vectomat(vec, ct->matrix[2],
(short)data->reserved1, (short)data->reserved2,
data->flags, totmat);
@@ -1111,7 +1111,7 @@ static bConstraintTypeInfo CTI_TRACKTO = {
static void kinematic_new_data(void *cdata)
{
bKinematicConstraint *data = (bKinematicConstraint *)cdata;
-
+
data->weight = 1.0f;
data->orientweight = 1.0f;
data->iterations = 500;
@@ -1122,10 +1122,10 @@ static void kinematic_new_data(void *cdata)
static void kinematic_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bKinematicConstraint *data = con->data;
-
+
/* chain target */
func(con, (ID **)&data->tar, false, userdata);
-
+
/* poletarget */
func(con, (ID **)&data->poletar, false, userdata);
}
@@ -1135,14 +1135,14 @@ static int kinematic_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bKinematicConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints is used twice here */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list);
-
+
return 2;
}
-
+
return 0;
}
@@ -1151,7 +1151,7 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bKinematicConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, no_copy);
@@ -1161,13 +1161,13 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
static void kinematic_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bKinematicConstraint *data = con->data;
-
- if (VALID_CONS_TARGET(ct))
+
+ if (VALID_CONS_TARGET(ct))
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail);
else if (ct) {
if (data->flag & CONSTRAINT_IK_AUTO) {
Object *ob = cob->ob;
-
+
if (ob == NULL) {
unit_m4(ct->matrix);
}
@@ -1204,7 +1204,7 @@ static bConstraintTypeInfo CTI_KINEMATIC = {
static void followpath_new_data(void *cdata)
{
bFollowPathConstraint *data = (bFollowPathConstraint *)cdata;
-
+
data->trackflag = TRACK_Y;
data->upflag = UP_Z;
data->offset = 0;
@@ -1214,7 +1214,7 @@ static void followpath_new_data(void *cdata)
static void followpath_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bFollowPathConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -1224,13 +1224,13 @@ static int followpath_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bFollowPathConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints without subtargets */
SINGLETARGETNS_GET_TARS(con, data->tar, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -1239,7 +1239,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy
if (con && list) {
bFollowPathConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
@@ -1248,7 +1248,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy
static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bFollowPathConstraint *data = con->data;
-
+
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) {
Curve *cu = ct->tar->data;
float vec[4], dir[3], radius;
@@ -1257,7 +1257,7 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
unit_m4(ct->matrix);
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
- * currently for paths to work it needs to go through the bevlist/displist system (ton)
+ * currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
#ifdef CYCLIC_DEPENDENCY_WORKAROUND
@@ -1272,9 +1272,9 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
/* animated position along curve depending on time */
Nurb *nu = cu->nurb.first;
curvetime = cu->ctime - data->offset;
-
+
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
+ * but this will only work if it actually is animated...
*
* we divide the curvetime calculated in the previous step by the length of the path, to get a time
* factor, which then gets clamped to lie within 0.0 - 1.0 range
@@ -1297,7 +1297,7 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
/* fixed position along curve */
curvetime = data->offset_fac;
}
-
+
if (where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/
float totmat[4][4];
unit_m4(totmat);
@@ -1306,7 +1306,7 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
#if 0
float x1, q[4];
vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag);
-
+
normalize_v3(dir);
q[0] = cosf(0.5 * vec[3]);
x1 = sinf(0.5 * vec[3]);
@@ -1327,9 +1327,9 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
mul_m4_m4m4(rmat, tmat, totmat);
copy_m4_m4(totmat, rmat);
}
-
+
copy_v3_v3(totmat[3], vec);
-
+
mul_m4_m4m4(ct->matrix, ct->tar->obmat, totmat);
}
}
@@ -1341,27 +1341,27 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
static void followpath_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float obmat[4][4];
float size[3];
bFollowPathConstraint *data = con->data;
-
+
/* get Object transform (loc/rot/size) to determine transformation from path */
/* TODO: this used to be local at one point, but is probably more useful as-is */
copy_m4_m4(obmat, cob->matrix);
-
+
/* get scaling of object before applying constraint */
mat4_to_size(size, cob->matrix);
-
+
/* apply targetmat - containing location on path, and rotation */
mul_m4_m4m4(cob->matrix, ct->matrix, obmat);
-
+
/* un-apply scaling caused by path */
if ((data->followflag & FOLLOWPATH_RADIUS) == 0) { /* XXX - assume that scale correction means that radius will have some scale error in it - Campbell */
float obsize[3];
-
+
mat4_to_size(obsize, cob->matrix);
if (obsize[0])
mul_v3_fl(cob->matrix[0], size[0] / obsize[0]);
@@ -1394,7 +1394,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = {
static void loclimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bLocLimitConstraint *data = con->data;
-
+
if (data->flag & LIMIT_XMIN) {
if (cob->matrix[3][0] < data->xmin)
cob->matrix[3][0] = data->xmin;
@@ -1412,7 +1412,7 @@ static void loclimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN
cob->matrix[3][1] = data->ymax;
}
if (data->flag & LIMIT_ZMIN) {
- if (cob->matrix[3][2] < data->zmin)
+ if (cob->matrix[3][2] < data->zmin)
cob->matrix[3][2] = data->zmin;
}
if (data->flag & LIMIT_ZMAX) {
@@ -1444,37 +1444,37 @@ static void rotlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN
float loc[3];
float eul[3];
float size[3];
-
+
copy_v3_v3(loc, cob->matrix[3]);
mat4_to_size(size, cob->matrix);
mat4_to_eulO(eul, cob->rotOrder, cob->matrix);
/* constraint data uses radians internally */
-
+
/* limiting of euler values... */
if (data->flag & LIMIT_XROT) {
- if (eul[0] < data->xmin)
+ if (eul[0] < data->xmin)
eul[0] = data->xmin;
-
+
if (eul[0] > data->xmax)
eul[0] = data->xmax;
}
if (data->flag & LIMIT_YROT) {
if (eul[1] < data->ymin)
eul[1] = data->ymin;
-
+
if (eul[1] > data->ymax)
eul[1] = data->ymax;
}
if (data->flag & LIMIT_ZROT) {
if (eul[2] < data->zmin)
eul[2] = data->zmin;
-
+
if (eul[2] > data->zmax)
eul[2] = data->zmax;
}
-
+
loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder);
}
@@ -1500,40 +1500,40 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U
{
bSizeLimitConstraint *data = con->data;
float obsize[3], size[3];
-
+
mat4_to_size(size, cob->matrix);
mat4_to_size(obsize, cob->matrix);
-
+
if (data->flag & LIMIT_XMIN) {
- if (size[0] < data->xmin)
+ if (size[0] < data->xmin)
size[0] = data->xmin;
}
if (data->flag & LIMIT_XMAX) {
- if (size[0] > data->xmax)
+ if (size[0] > data->xmax)
size[0] = data->xmax;
}
if (data->flag & LIMIT_YMIN) {
- if (size[1] < data->ymin)
+ if (size[1] < data->ymin)
size[1] = data->ymin;
}
if (data->flag & LIMIT_YMAX) {
- if (size[1] > data->ymax)
+ if (size[1] > data->ymax)
size[1] = data->ymax;
}
if (data->flag & LIMIT_ZMIN) {
- if (size[2] < data->zmin)
+ if (size[2] < data->zmin)
size[2] = data->zmin;
}
if (data->flag & LIMIT_ZMAX) {
- if (size[2] > data->zmax)
+ if (size[2] > data->zmax)
size[2] = data->zmax;
}
-
- if (obsize[0])
+
+ if (obsize[0])
mul_v3_fl(cob->matrix[0], size[0] / obsize[0]);
- if (obsize[1])
+ if (obsize[1])
mul_v3_fl(cob->matrix[1], size[1] / obsize[1]);
- if (obsize[2])
+ if (obsize[2])
mul_v3_fl(cob->matrix[2], size[2] / obsize[2]);
}
@@ -1557,14 +1557,14 @@ static bConstraintTypeInfo CTI_SIZELIMIT = {
static void loclike_new_data(void *cdata)
{
bLocateLikeConstraint *data = (bLocateLikeConstraint *)cdata;
-
+
data->flag = LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z;
}
static void loclike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bLocateLikeConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -1574,13 +1574,13 @@ static int loclike_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bLocateLikeConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -1589,7 +1589,7 @@ static void loclike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bLocateLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -1599,28 +1599,28 @@ static void loclike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
{
bLocateLikeConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float offset[3] = {0.0f, 0.0f, 0.0f};
-
+
if (data->flag & LOCLIKE_OFFSET)
copy_v3_v3(offset, cob->matrix[3]);
-
+
if (data->flag & LOCLIKE_X) {
cob->matrix[3][0] = ct->matrix[3][0];
-
+
if (data->flag & LOCLIKE_X_INVERT) cob->matrix[3][0] *= -1;
cob->matrix[3][0] += offset[0];
}
if (data->flag & LOCLIKE_Y) {
cob->matrix[3][1] = ct->matrix[3][1];
-
+
if (data->flag & LOCLIKE_Y_INVERT) cob->matrix[3][1] *= -1;
cob->matrix[3][1] += offset[1];
}
if (data->flag & LOCLIKE_Z) {
cob->matrix[3][2] = ct->matrix[3][2];
-
+
if (data->flag & LOCLIKE_Z_INVERT) cob->matrix[3][2] *= -1;
cob->matrix[3][2] += offset[2];
}
@@ -1647,14 +1647,14 @@ static bConstraintTypeInfo CTI_LOCLIKE = {
static void rotlike_new_data(void *cdata)
{
bRotateLikeConstraint *data = (bRotateLikeConstraint *)cdata;
-
+
data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
static void rotlike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bRotateLikeConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -1664,13 +1664,13 @@ static int rotlike_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bRotateLikeConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -1679,7 +1679,7 @@ static void rotlike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bRotateLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -1689,50 +1689,50 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
{
bRotateLikeConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float loc[3];
float eul[3], obeul[3];
float size[3];
-
+
copy_v3_v3(loc, cob->matrix[3]);
mat4_to_size(size, cob->matrix);
-
+
/* to allow compatible rotations, must get both rotations in the order of the owner... */
mat4_to_eulO(obeul, cob->rotOrder, cob->matrix);
/* we must get compatible eulers from the beginning because some of them can be modified below (see bug #21875) */
mat4_to_compatible_eulO(eul, obeul, cob->rotOrder, ct->matrix);
-
+
if ((data->flag & ROTLIKE_X) == 0)
eul[0] = obeul[0];
else {
if (data->flag & ROTLIKE_OFFSET)
rotate_eulO(eul, cob->rotOrder, 'X', obeul[0]);
-
+
if (data->flag & ROTLIKE_X_INVERT)
eul[0] *= -1;
}
-
+
if ((data->flag & ROTLIKE_Y) == 0)
eul[1] = obeul[1];
else {
if (data->flag & ROTLIKE_OFFSET)
rotate_eulO(eul, cob->rotOrder, 'Y', obeul[1]);
-
+
if (data->flag & ROTLIKE_Y_INVERT)
eul[1] *= -1;
}
-
+
if ((data->flag & ROTLIKE_Z) == 0)
eul[2] = obeul[2];
else {
if (data->flag & ROTLIKE_OFFSET)
rotate_eulO(eul, cob->rotOrder, 'Z', obeul[2]);
-
+
if (data->flag & ROTLIKE_Z_INVERT)
eul[2] *= -1;
}
-
+
/* good to make eulers compatible again, since we don't know how much they were changed above */
compatible_eul(eul, obeul);
loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder);
@@ -1759,14 +1759,14 @@ static bConstraintTypeInfo CTI_ROTLIKE = {
static void sizelike_new_data(void *cdata)
{
bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata;
-
+
data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z;
}
static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bSizeLikeConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -1776,13 +1776,13 @@ static int sizelike_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bSizeLikeConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -1791,7 +1791,7 @@ static void sizelike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bSizeLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -1801,13 +1801,13 @@ static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
{
bSizeLikeConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float obsize[3], size[3];
-
+
mat4_to_size(size, ct->matrix);
mat4_to_size(obsize, cob->matrix);
-
+
if ((data->flag & SIZELIKE_X) && (obsize[0] != 0)) {
if (data->flag & SIZELIKE_OFFSET) {
size[0] += (obsize[0] - 1.0f);
@@ -1855,7 +1855,7 @@ static bConstraintTypeInfo CTI_SIZELIKE = {
static void translike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bTransLikeConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -1865,13 +1865,13 @@ static int translike_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bTransLikeConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -1880,7 +1880,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bTransLikeConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -1889,7 +1889,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
static void translike_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
/* just copy the entire transform matrix of the target */
copy_m4_m4(cob->matrix, ct->matrix);
@@ -1930,12 +1930,12 @@ static void samevolume_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *
float obsize[3];
mat4_to_size(obsize, cob->matrix);
-
+
/* calculate normalizing scale factor for non-essential values */
total_scale = obsize[0] * obsize[1] * obsize[2];
if (total_scale != 0)
fac = sqrtf(volume / total_scale);
-
+
/* apply scaling factor to the channels not being kept */
switch (data->flag) {
case SAMEVOL_X:
@@ -1973,20 +1973,20 @@ static bConstraintTypeInfo CTI_SAMEVOL = {
static void pycon_free(bConstraint *con)
{
bPythonConstraint *data = con->data;
-
+
/* id-properties */
IDP_FreeProperty(data->prop);
MEM_freeN(data->prop);
-
+
/* multiple targets */
BLI_freelistN(&data->targets);
-}
+}
static void pycon_copy(bConstraint *con, bConstraint *srccon)
{
bPythonConstraint *pycon = (bPythonConstraint *)con->data;
bPythonConstraint *opycon = (bPythonConstraint *)srccon->data;
-
+
pycon->prop = IDP_CopyProperty(opycon->prop);
BLI_duplicatelist(&pycon->targets, &opycon->targets);
}
@@ -1994,7 +1994,7 @@ static void pycon_copy(bConstraint *con, bConstraint *srccon)
static void pycon_new_data(void *cdata)
{
bPythonConstraint *data = (bPythonConstraint *)cdata;
-
+
/* everything should be set correctly by calloc, except for the prop->type constant.*/
data->prop = MEM_callocN(sizeof(IDProperty), "PyConstraintProps");
data->prop->type = IDP_GROUP;
@@ -2004,13 +2004,13 @@ static int pycon_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
bPythonConstraint *data = con->data;
-
+
list->first = data->targets.first;
list->last = data->targets.last;
-
+
return data->tarnum;
}
-
+
return 0;
}
@@ -2018,11 +2018,11 @@ static void pycon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userd
{
bPythonConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* targets */
for (ct = data->targets.first; ct; ct = ct->next)
func(con, (ID **)&ct->tar, false, userdata);
-
+
/* script */
func(con, (ID **)&data->text, true, userdata);
}
@@ -2048,7 +2048,7 @@ static void pycon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTa
* this matrix if it needs to do so
*/
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail);
-
+
/* only execute target calculation if allowed */
#ifdef WITH_PYTHON
if (G.f & G_SCRIPT_AUTOEXEC)
@@ -2066,19 +2066,19 @@ static void pycon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targe
return;
#else
bPythonConstraint *data = con->data;
-
+
/* only evaluate in python if we're allowed to do so */
if ((G.f & G_SCRIPT_AUTOEXEC) == 0) return;
-
+
/* currently removed, until I this can be re-implemented for multiple targets */
#if 0
- /* Firstly, run the 'driver' function which has direct access to the objects involved
+ /* Firstly, run the 'driver' function which has direct access to the objects involved
* Technically, this is potentially dangerous as users may abuse this and cause dependency-problems,
* but it also allows certain 'clever' rigging hacks to work.
*/
BPY_pyconstraint_driver(data, cob, targets);
#endif
-
+
/* Now, run the actual 'constraint' function, which should only access the matrices */
BPY_pyconstraint_exec(data, cob, targets);
#endif /* WITH_PYTHON */
@@ -2104,7 +2104,7 @@ static bConstraintTypeInfo CTI_PYTHON = {
static void actcon_new_data(void *cdata)
{
bActionConstraint *data = (bActionConstraint *)cdata;
-
+
/* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */
data->type = 20;
}
@@ -2112,10 +2112,10 @@ static void actcon_new_data(void *cdata)
static void actcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bActionConstraint *data = con->data;
-
+
/* target */
func(con, (ID **)&data->tar, false, userdata);
-
+
/* action */
func(con, (ID **)&data->act, true, userdata);
}
@@ -2125,13 +2125,13 @@ static int actcon_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bActionConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -2140,7 +2140,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bActionConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -2149,18 +2149,18 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bActionConstraint *data = con->data;
-
+
if (VALID_CONS_TARGET(ct)) {
float tempmat[4][4], vec[3];
float s, t;
short axis;
-
+
/* initialize return matrix */
unit_m4(ct->matrix);
-
+
/* get the transform matrix of the target */
constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail);
-
+
/* determine where in transform range target is */
/* data->type is mapped as follows for backwards compatibility:
* 00,01,02 - rotation (it used to be like this)
@@ -2183,21 +2183,21 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
copy_v3_v3(vec, tempmat[3]);
axis = data->type - 20;
}
-
+
BLI_assert((unsigned int)axis < 3);
/* Target defines the animation */
s = (vec[axis] - data->min) / (data->max - data->min);
CLAMP(s, 0, 1);
t = (s * (data->end - data->start)) + data->start;
-
+
if (G.debug & G_DEBUG)
printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name + 2, (cob->pchan) ? cob->pchan->name : NULL);
-
+
/* Get the appropriate information from the action */
if (cob->type == CONSTRAINT_OBTYPE_OBJECT || (data->flag & ACTCON_BONE_USE_OBJECT_ACTION)) {
Object workob;
-
+
/* evaluate using workob */
/* FIXME: we don't have any consistent standards on limiting effects on object... */
what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
@@ -2208,21 +2208,21 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
bPose pose = {{0}};
bPoseChannel *pchan, *tchan;
- /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set
+ /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set
* - we need to manually copy over a few settings, including rotation order, otherwise this fails
*/
pchan = cob->pchan;
-
+
tchan = BKE_pose_channel_verify(&pose, pchan->name);
tchan->rotmode = pchan->rotmode;
-
+
/* evaluate action using workob (it will only set the PoseChannel in question) */
what_does_obaction(cob->ob, &workob, &pose, data->act, pchan->name, t);
-
+
/* convert animation to matrices for use here */
BKE_pchan_calc_mat(tchan);
copy_m4_m4(ct->matrix, tchan->chan_mat);
-
+
/* Clean up */
BKE_pose_free_data(&pose);
}
@@ -2236,10 +2236,10 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
static void actcon_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float temp[4][4];
-
+
/* Nice and simple... we just need to multiply the matrices, as the get_target_matrix
* function has already taken care of everything else.
*/
@@ -2268,15 +2268,15 @@ static bConstraintTypeInfo CTI_ACTION = {
static void locktrack_new_data(void *cdata)
{
bLockTrackConstraint *data = (bLockTrackConstraint *)cdata;
-
+
data->trackflag = TRACK_Y;
data->lockflag = LOCK_Z;
-}
+}
static void locktrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bLockTrackConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -2286,13 +2286,13 @@ static int locktrack_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bLockTrackConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -2301,7 +2301,7 @@ static void locktrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bLockTrackConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -2311,14 +2311,14 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
{
bLockTrackConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float vec[3], vec2[3];
float totmat[3][3];
float tmpmat[3][3];
float invmat[3][3];
float mdet;
-
+
/* Vector object -> target */
sub_v3_v3v3(vec, ct->matrix[3], cob->matrix[3]);
switch (data->lockflag) {
@@ -2331,10 +2331,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[0]);
sub_v3_v3v3(totmat[1], vec, vec2);
normalize_v3(totmat[1]);
-
+
/* the x axis is fixed */
normalize_v3_v3(totmat[0], cob->matrix[0]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
break;
@@ -2345,10 +2345,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[0]);
sub_v3_v3v3(totmat[2], vec, vec2);
normalize_v3(totmat[2]);
-
+
/* the x axis is fixed */
normalize_v3_v3(totmat[0], cob->matrix[0]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
break;
@@ -2360,10 +2360,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[1], vec, vec2);
normalize_v3(totmat[1]);
negate_v3(totmat[1]);
-
+
/* the x axis is fixed */
normalize_v3_v3(totmat[0], cob->matrix[0]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
break;
@@ -2375,10 +2375,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[2], vec, vec2);
normalize_v3(totmat[2]);
negate_v3(totmat[2]);
-
+
/* the x axis is fixed */
normalize_v3_v3(totmat[0], cob->matrix[0]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
break;
@@ -2400,7 +2400,7 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[1]);
sub_v3_v3v3(totmat[0], vec, vec2);
normalize_v3(totmat[0]);
-
+
/* the y axis is fixed */
normalize_v3_v3(totmat[1], cob->matrix[1]);
@@ -2414,10 +2414,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[1]);
sub_v3_v3v3(totmat[2], vec, vec2);
normalize_v3(totmat[2]);
-
+
/* the y axis is fixed */
normalize_v3_v3(totmat[1], cob->matrix[1]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
break;
@@ -2429,10 +2429,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[0], vec, vec2);
normalize_v3(totmat[0]);
negate_v3(totmat[0]);
-
+
/* the y axis is fixed */
normalize_v3_v3(totmat[1], cob->matrix[1]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
break;
@@ -2444,10 +2444,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[2], vec, vec2);
normalize_v3(totmat[2]);
negate_v3(totmat[2]);
-
+
/* the y axis is fixed */
normalize_v3_v3(totmat[1], cob->matrix[1]);
-
+
/* the z axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
break;
@@ -2469,10 +2469,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[2]);
sub_v3_v3v3(totmat[0], vec, vec2);
normalize_v3(totmat[0]);
-
+
/* the z axis is fixed */
normalize_v3_v3(totmat[2], cob->matrix[2]);
-
+
/* the x axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
break;
@@ -2483,10 +2483,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
project_v3_v3v3(vec2, vec, cob->matrix[2]);
sub_v3_v3v3(totmat[1], vec, vec2);
normalize_v3(totmat[1]);
-
+
/* the z axis is fixed */
normalize_v3_v3(totmat[2], cob->matrix[2]);
-
+
/* the x axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
break;
@@ -2498,10 +2498,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[0], vec, vec2);
normalize_v3(totmat[0]);
negate_v3(totmat[0]);
-
+
/* the z axis is fixed */
normalize_v3_v3(totmat[2], cob->matrix[2]);
-
+
/* the x axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
break;
@@ -2513,10 +2513,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sub_v3_v3v3(totmat[1], vec, vec2);
normalize_v3(totmat[1]);
negate_v3(totmat[1]);
-
+
/* the z axis is fixed */
normalize_v3_v3(totmat[2], cob->matrix[2]);
-
+
/* the x axis gets mapped onto a third orthogonal vector */
cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
break;
@@ -2543,14 +2543,14 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
totmat[0][0] = tmpmat[0][0]; totmat[0][1] = tmpmat[0][1]; totmat[0][2] = tmpmat[0][2];
totmat[1][0] = tmpmat[1][0]; totmat[1][1] = tmpmat[1][1]; totmat[1][2] = tmpmat[1][2];
totmat[2][0] = tmpmat[2][0]; totmat[2][1] = tmpmat[2][1]; totmat[2][2] = tmpmat[2][2];
-
+
mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2],
totmat[1][0], totmat[1][1], totmat[1][2],
totmat[2][0], totmat[2][1], totmat[2][2]);
if (mdet == 0) {
unit_m3(totmat);
}
-
+
/* apply out transformaton to the object */
mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
@@ -2576,14 +2576,14 @@ static bConstraintTypeInfo CTI_LOCKTRACK = {
static void distlimit_new_data(void *cdata)
{
bDistLimitConstraint *data = (bDistLimitConstraint *)cdata;
-
+
data->dist = 0.0f;
}
static void distlimit_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bDistLimitConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -2593,13 +2593,13 @@ static int distlimit_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bDistLimitConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -2608,7 +2608,7 @@ static void distlimit_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bDistLimitConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -2618,19 +2618,19 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
{
bDistLimitConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float dvec[3], dist, sfac = 1.0f;
short clamp_surf = 0;
-
+
/* calculate our current distance from the target */
dist = len_v3v3(cob->matrix[3], ct->matrix[3]);
-
+
/* set distance (flag is only set when user demands it) */
if (data->dist == 0)
data->dist = dist;
-
+
/* check if we're which way to clamp from, and calculate interpolation factor (if needed) */
if (data->mode == LIMITDIST_OUTSIDE) {
/* if inside, then move to surface */
@@ -2657,7 +2657,7 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
if (dist >= (data->dist - data->soft)) {
sfac = (float)(data->soft * (1.0f - expf(-(dist - data->dist) / data->soft)) + data->dist);
if (dist != 0.0f) sfac /= dist;
-
+
clamp_surf = 1;
}
}
@@ -2668,12 +2668,12 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
if (dist != 0.0f) sfac = data->dist / dist;
}
}
-
+
/* clamp to 'surface' (i.e. move owner so that dist == data->dist) */
if (clamp_surf) {
/* simply interpolate along line formed by target -> owner */
interp_v3_v3v3(dvec, ct->matrix[3], cob->matrix[3], sfac);
-
+
/* copy new vector onto owner */
copy_v3_v3(cob->matrix[3], dvec);
}
@@ -2700,10 +2700,10 @@ static bConstraintTypeInfo CTI_DISTLIMIT = {
static void stretchto_new_data(void *cdata)
{
bStretchToConstraint *data = (bStretchToConstraint *)cdata;
-
+
data->volmode = 0;
data->plane = 0;
- data->orglength = 0.0;
+ data->orglength = 0.0;
data->bulge = 1.0;
data->bulge_max = 1.0f;
data->bulge_min = 1.0f;
@@ -2712,7 +2712,7 @@ static void stretchto_new_data(void *cdata)
static void stretchto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bStretchToConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -2722,13 +2722,13 @@ static int stretchto_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bStretchToConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -2737,7 +2737,7 @@ static void stretchto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bStretchToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -2747,51 +2747,51 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
{
bStretchToConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float size[3], scale[3], vec[3], xx[3], zz[3], orth[3];
float totmat[3][3];
float dist, bulge;
-
+
/* store scaling before destroying obmat */
mat4_to_size(size, cob->matrix);
-
+
/* store X orientation before destroying obmat */
normalize_v3_v3(xx, cob->matrix[0]);
-
+
/* store Z orientation before destroying obmat */
normalize_v3_v3(zz, cob->matrix[2]);
-
+
/* XXX That makes the constraint buggy with asymmetrically scaled objects, see #29940. */
/* sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);*/
/* vec[0] /= size[0];*/
/* vec[1] /= size[1];*/
/* vec[2] /= size[2];*/
-
+
/* dist = normalize_v3(vec);*/
dist = len_v3v3(cob->matrix[3], ct->matrix[3]);
/* Only Y constrained object axis scale should be used, to keep same length when scaling it. */
dist /= size[1];
-
+
/* data->orglength==0 occurs on first run, and after 'R' button is clicked */
if (data->orglength == 0)
data->orglength = dist;
scale[1] = dist / data->orglength;
-
+
bulge = powf(data->orglength / dist, data->bulge);
-
+
if (bulge > 1.0f) {
if (data->flag & STRETCHTOCON_USE_BULGE_MAX) {
float bulge_max = max_ff(data->bulge_max, 1.0f);
float hard = min_ff(bulge, bulge_max);
-
+
float range = bulge_max - 1.0f;
float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f + range * atanf((bulge - 1.0f) * scale_fac) / (float)M_PI_2;
-
+
bulge = interpf(soft, hard, data->bulge_smooth);
}
}
@@ -2799,15 +2799,15 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
if (data->flag & STRETCHTOCON_USE_BULGE_MIN) {
float bulge_min = CLAMPIS(data->bulge_min, 0.0f, 1.0f);
float hard = max_ff(bulge, bulge_min);
-
+
float range = 1.0f - bulge_min;
float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f - range * atanf((1.0f - bulge) * scale_fac) / (float)M_PI_2;
-
+
bulge = interpf(soft, hard, data->bulge_smooth);
}
}
-
+
switch (data->volmode) {
/* volume preserving scaling */
case VOLUME_XZ:
@@ -2830,7 +2830,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
default: /* should not happen, but in case*/
return;
} /* switch (data->volmode) */
-
+
/* Clear the object's rotation and scale */
cob->matrix[0][0] = size[0] * scale[0];
cob->matrix[0][1] = 0;
@@ -2841,10 +2841,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
cob->matrix[2][0] = 0;
cob->matrix[2][1] = 0;
cob->matrix[2][2] = size[2] * scale[2];
-
+
sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
normalize_v3(vec);
-
+
/* new Y aligns object target connection*/
negate_v3_v3(totmat[1], vec);
switch (data->plane) {
@@ -2853,10 +2853,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
/* othogonal to "new Y" "old X! plane */
cross_v3_v3v3(orth, vec, xx);
normalize_v3(orth);
-
+
/* new Z*/
copy_v3_v3(totmat[2], orth);
-
+
/* we decided to keep X plane*/
cross_v3_v3v3(xx, orth, vec);
normalize_v3_v3(totmat[0], xx);
@@ -2866,16 +2866,16 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
/* othogonal to "new Y" "old Z! plane */
cross_v3_v3v3(orth, vec, zz);
normalize_v3(orth);
-
+
/* new X */
negate_v3_v3(totmat[0], orth);
-
+
/* we decided to keep Z */
cross_v3_v3v3(zz, orth, vec);
normalize_v3_v3(totmat[2], zz);
break;
} /* switch (data->plane) */
-
+
mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
}
@@ -2900,7 +2900,7 @@ static bConstraintTypeInfo CTI_STRETCHTO = {
static void minmax_new_data(void *cdata)
{
bMinMaxConstraint *data = (bMinMaxConstraint *)cdata;
-
+
data->minmaxflag = TRACK_Z;
data->offset = 0.0f;
zero_v3(data->cache);
@@ -2910,7 +2910,7 @@ static void minmax_new_data(void *cdata)
static void minmax_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bMinMaxConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -2920,13 +2920,13 @@ static int minmax_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bMinMaxConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -2935,7 +2935,7 @@ static void minmax_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bMinMaxConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -2945,16 +2945,16 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
{
bMinMaxConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float obmat[4][4], imat[4][4], tarmat[4][4], tmat[4][4];
float val1, val2;
int index;
-
+
copy_m4_m4(obmat, cob->matrix);
copy_m4_m4(tarmat, ct->matrix);
-
+
if (data->flag & MINMAX_USEROT) {
/* take rotation of target into account by doing the transaction in target's localspace */
invert_m4_m4(imat, tarmat);
@@ -2962,7 +2962,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
copy_m4_m4(obmat, tmat);
unit_m4(tarmat);
}
-
+
switch (data->minmaxflag) {
case TRACK_Z:
val1 = tarmat[3][2];
@@ -2997,7 +2997,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
default:
return;
}
-
+
if (val1 > val2) {
obmat[3][index] = tarmat[3][index] + data->offset;
if (data->flag & MINMAX_STICKY) {
@@ -3044,7 +3044,7 @@ static bConstraintTypeInfo CTI_MINMAX = {
static void rbj_new_data(void *cdata)
{
bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)cdata;
-
+
/* removed code which set target of this constraint */
data->type = 1;
}
@@ -3052,7 +3052,7 @@ static void rbj_new_data(void *cdata)
static void rbj_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bRigidBodyJointConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
func(con, (ID **)&data->child, false, userdata);
@@ -3063,13 +3063,13 @@ static int rbj_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bRigidBodyJointConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints without subtargets */
SINGLETARGETNS_GET_TARS(con, data->tar, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3078,7 +3078,7 @@ static void rbj_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bRigidBodyJointConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
@@ -3104,7 +3104,7 @@ static bConstraintTypeInfo CTI_RIGIDBODYJOINT = {
static void clampto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bClampToConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -3114,13 +3114,13 @@ static int clampto_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bClampToConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints without subtargets */
SINGLETARGETNS_GET_TARS(con, data->tar, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3129,7 +3129,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bClampToConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
@@ -3156,33 +3156,33 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
{
bClampToConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target and it is a curve */
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) {
float obmat[4][4], ownLoc[3];
float curveMin[3], curveMax[3];
float targetMatrix[4][4];
-
+
copy_m4_m4(obmat, cob->matrix);
copy_v3_v3(ownLoc, obmat[3]);
-
+
unit_m4(targetMatrix);
INIT_MINMAX(curveMin, curveMax);
/* XXX - don't think this is good calling this here - campbell */
BKE_object_minmax(ct->tar, curveMin, curveMax, true);
-
+
/* get targetmatrix */
if (data->tar->curve_cache && data->tar->curve_cache->path && data->tar->curve_cache->path->data) {
float vec[4], dir[3], totmat[4][4];
float curvetime;
short clamp_axis;
-
+
/* find best position on curve */
/* 1. determine which axis to sample on? */
if (data->flag == CLAMPTO_AUTO) {
float size[3];
sub_v3_v3v3(size, curveMax, curveMin);
-
+
/* find axis along which the bounding box has the greatest
* extent. Otherwise, default to the x-axis, as that is quite
* frequently used.
@@ -3194,15 +3194,15 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
else
clamp_axis = CLAMPTO_X - 1;
}
- else
+ else
clamp_axis = data->flag - 1;
-
+
/* 2. determine position relative to curve on a 0-1 scale based on bounding box */
if (data->flag2 & CLAMPTO_CYCLIC) {
/* cyclic, so offset within relative bounding box is used */
float len = (curveMax[clamp_axis] - curveMin[clamp_axis]);
float offset;
-
+
/* check to make sure len is not so close to zero that it'll cause errors */
if (IS_EQF(len, 0.0f) == false) {
/* find bounding-box range where target is located */
@@ -3238,19 +3238,19 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
curvetime = 1.0f;
else if (IS_EQF((curveMax[clamp_axis] - curveMin[clamp_axis]), 0.0f) == false)
curvetime = (ownLoc[clamp_axis] - curveMin[clamp_axis]) / (curveMax[clamp_axis] - curveMin[clamp_axis]);
- else
+ else
curvetime = 0.0f;
}
-
+
/* 3. position on curve */
if (where_on_path(ct->tar, curvetime, vec, dir, NULL, NULL, NULL) ) {
unit_m4(totmat);
copy_v3_v3(totmat[3], vec);
-
+
mul_m4_m4m4(targetMatrix, ct->tar->obmat, totmat);
}
}
-
+
/* obtain final object position */
copy_v3_v3(cob->matrix[3], targetMatrix[3]);
}
@@ -3276,7 +3276,7 @@ static bConstraintTypeInfo CTI_CLAMPTO = {
static void transform_new_data(void *cdata)
{
bTransformConstraint *data = (bTransformConstraint *)cdata;
-
+
data->map[0] = 0;
data->map[1] = 1;
data->map[2] = 2;
@@ -3285,7 +3285,7 @@ static void transform_new_data(void *cdata)
static void transform_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bTransformConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -3295,13 +3295,13 @@ static int transform_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bTransformConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3310,7 +3310,7 @@ static void transform_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bTransformConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -3320,21 +3320,21 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
{
bTransformConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float *from_min, *from_max, *to_min, *to_max;
float loc[3], eul[3], size[3];
float dvec[3], sval[3];
int i;
-
+
/* obtain target effect */
switch (data->from) {
case TRANS_SCALE:
mat4_to_size(dvec, ct->matrix);
-
+
if (is_negative_m4(ct->matrix)) {
- /* Bugfix [#27886]
+ /* Bugfix [#27886]
* We can't be sure which axis/axes are negative, though we know that something is negative.
* Assume we don't care about negativity of separate axes. <--- This is a limitation that
* riggers will have to live with for now.
@@ -3356,12 +3356,12 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
from_max = data->from_max;
break;
}
-
+
/* extract components of owner's matrix */
copy_v3_v3(loc, cob->matrix[3]);
mat4_to_eulO(eul, cob->rotOrder, cob->matrix);
mat4_to_size(size, cob->matrix);
-
+
/* determine where in range current transforms lie */
if (data->expo) {
for (i = 0; i < 3; i++) {
@@ -3381,8 +3381,8 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
sval[i] = 0.0f;
}
}
-
-
+
+
/* apply transforms */
switch (data->to) {
case TRANS_SCALE:
@@ -3413,7 +3413,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
}
break;
}
-
+
/* apply to matrix */
loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder);
}
@@ -3439,7 +3439,7 @@ static bConstraintTypeInfo CTI_TRANSFORM = {
static void shrinkwrap_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bShrinkwrapConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->target, false, userdata);
}
@@ -3457,12 +3457,12 @@ static int shrinkwrap_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bShrinkwrapConstraint *data = con->data;
bConstraintTarget *ct;
-
+
SINGLETARGETNS_GET_TARS(con, data->target, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3472,7 +3472,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy
if (con && list) {
bShrinkwrapConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, no_copy);
}
}
@@ -3481,22 +3481,22 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy
static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
-
+
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) {
bool fail = false;
float co[3] = {0.0f, 0.0f, 0.0f};
-
+
SpaceTransform transform;
/* TODO(sergey): use proper for_render flag here when known. */
DerivedMesh *target = object_get_derived_final(ct->tar, false);
-
+
BVHTreeFromMesh treeData = {NULL};
-
+
unit_m4(ct->matrix);
-
+
if (target != NULL) {
BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat);
-
+
switch (scon->shrinkType) {
case MOD_SHRINKWRAP_NEAREST_SURFACE:
case MOD_SHRINKWRAP_NEAREST_VERTEX:
@@ -3511,16 +3511,16 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_VERTS, 2);
else
bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 2);
-
+
if (treeData.tree == NULL) {
fail = true;
break;
}
-
+
BLI_space_transform_apply(&transform, co);
-
+
BLI_bvhtree_find_nearest(treeData.tree, co, &nearest, treeData.nearest_callback, &treeData);
-
+
dist = len_v3v3(co, nearest.co);
if (dist != 0.0f) {
interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist) / dist); /* linear interpolation */
@@ -3547,7 +3547,7 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
no[scon->projAxis - OB_NEGX] = -1.0f;
break;
}
-
+
/* transform normal into requested space */
/* Note that in this specific case, we need to keep scaling in non-parented 'local2world' object
* case, because SpaceTransform also takes it into account when handling normals. See T42447. */
@@ -3578,14 +3578,14 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
break;
}
}
-
+
free_bvhtree_from_mesh(&treeData);
-
+
if (fail == true) {
/* Don't move the point */
zero_v3(co);
}
-
+
/* co is in local object coordinates, change it to global and update target position */
mul_m4_v3(cob->matrix, co);
copy_v3_v3(ct->matrix[3], co);
@@ -3596,7 +3596,7 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
static void shrinkwrap_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct = targets->first;
-
+
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
copy_v3_v3(cob->matrix[3], ct->matrix[3]);
@@ -3623,14 +3623,14 @@ static bConstraintTypeInfo CTI_SHRINKWRAP = {
static void damptrack_new_data(void *cdata)
{
bDampTrackConstraint *data = (bDampTrackConstraint *)cdata;
-
+
data->trackflag = TRACK_Y;
-}
+}
static void damptrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bDampTrackConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -3640,13 +3640,13 @@ static int damptrack_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bDampTrackConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3655,7 +3655,7 @@ static void damptrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bDampTrackConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -3671,60 +3671,60 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
{
bDampTrackConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
if (VALID_CONS_TARGET(ct)) {
float obvec[3], tarvec[3], obloc[3];
float raxis[3], rangle;
float rmat[3][3], tmat[4][4];
-
- /* find the (unit) direction that the axis we're interested in currently points
- * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix
+
+ /* find the (unit) direction that the axis we're interested in currently points
+ * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix
* - the normalization step at the end should take care of any unwanted scaling
* left over in the 3x3 matrix we used
*/
copy_v3_v3(obvec, track_dir_vecs[data->trackflag]);
mul_mat3_m4_v3(cob->matrix, obvec);
-
+
if (normalize_v3(obvec) == 0.0f) {
/* exceptional case - just use the track vector as appropriate */
copy_v3_v3(obvec, track_dir_vecs[data->trackflag]);
}
-
+
/* find the (unit) direction vector going from the owner to the target */
copy_v3_v3(obloc, cob->matrix[3]);
sub_v3_v3v3(tarvec, ct->matrix[3], obloc);
-
+
if (normalize_v3(tarvec) == 0.0f) {
/* the target is sitting on the owner, so just make them use the same direction vectors */
/* FIXME: or would it be better to use the pure direction vector? */
copy_v3_v3(tarvec, obvec);
//copy_v3_v3(tarvec, track_dir_vecs[data->trackflag]);
}
-
+
/* determine the axis-angle rotation, which represents the smallest possible rotation
* between the two rotation vectors (i.e. the 'damping' referred to in the name)
* - we take this to be the rotation around the normal axis/vector to the plane defined
- * by the current and destination vectors, which will 'map' the current axis to the
+ * by the current and destination vectors, which will 'map' the current axis to the
* destination vector
* - the min/max wrappers around (obvec . tarvec) result (stored temporarily in rangle)
* are used to ensure that the smallest angle is chosen
*/
cross_v3_v3v3(raxis, obvec, tarvec);
-
+
rangle = dot_v3v3(obvec, tarvec);
rangle = acosf(max_ff(-1.0f, min_ff(1.0f, rangle)));
-
- /* construct rotation matrix from the axis-angle rotation found above
+
+ /* construct rotation matrix from the axis-angle rotation found above
* - this call takes care to make sure that the axis provided is a unit vector first
*/
axis_angle_to_mat3(rmat, raxis, rangle);
-
+
/* rotate the owner in the way defined by this rotation matrix, then reapply the location since
* we may have destroyed that in the process of multiplying the matrix
*/
unit_m4(tmat);
mul_m4_m3m4(tmat, rmat, cob->matrix); // m1, m3, m2
-
+
copy_m4_m4(cob->matrix, tmat);
copy_v3_v3(cob->matrix[3], obloc);
}
@@ -3750,17 +3750,17 @@ static bConstraintTypeInfo CTI_DAMPTRACK = {
static void splineik_free(bConstraint *con)
{
bSplineIKConstraint *data = con->data;
-
+
/* binding array */
if (data->points)
MEM_freeN(data->points);
-}
+}
static void splineik_copy(bConstraint *con, bConstraint *srccon)
{
bSplineIKConstraint *src = srccon->data;
bSplineIKConstraint *dst = con->data;
-
+
/* copy the binding array */
dst->points = MEM_dupallocN(src->points);
}
@@ -3778,7 +3778,7 @@ static void splineik_new_data(void *cdata)
static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bSplineIKConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -3788,13 +3788,13 @@ static int splineik_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bSplineIKConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints without subtargets */
SINGLETARGETNS_GET_TARS(con, data->tar, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3803,7 +3803,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bSplineIKConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy);
}
@@ -3846,7 +3846,7 @@ static bConstraintTypeInfo CTI_SPLINEIK = {
static void pivotcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bPivotConstraint *data = con->data;
-
+
/* target only */
func(con, (ID **)&data->tar, false, userdata);
}
@@ -3856,13 +3856,13 @@ static int pivotcon_get_tars(bConstraint *con, ListBase *list)
if (con && list) {
bPivotConstraint *data = con->data;
bConstraintTarget *ct;
-
+
/* standard target-getting macro for single-target constraints */
SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
-
+
return 1;
}
-
+
return 0;
}
@@ -3871,7 +3871,7 @@ static void pivotcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy)
if (con && list) {
bPivotConstraint *data = con->data;
bConstraintTarget *ct = list->first;
-
+
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy);
}
@@ -3881,20 +3881,20 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
{
bPivotConstraint *data = con->data;
bConstraintTarget *ct = targets->first;
-
+
float pivot[3], vec[3];
float rotMat[3][3];
/* pivot correction */
float axis[3], angle;
-
+
/* firstly, check if pivoting should take place based on the current rotation */
if (data->rotAxis != PIVOTCON_AXIS_NONE) {
float rot[3];
-
+
/* extract euler-rotation of target */
mat4_to_eulO(rot, cob->rotOrder, cob->matrix);
-
+
/* check which range might be violated */
if (data->rotAxis < PIVOTCON_AXIS_X) {
/* negative rotations (data->rotAxis = 0 -> 2) */
@@ -3907,7 +3907,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
return;
}
}
-
+
/* find the pivot-point to use */
if (VALID_CONS_TARGET(ct)) {
/* apply offset to target location */
@@ -3924,7 +3924,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
copy_v3_v3(pivot, data->offset);
}
}
-
+
/* get rotation matrix representing the rotation of the owner */
/* TODO: perhaps we might want to include scaling based on the pivot too? */
copy_m3_m4(rotMat, cob->matrix);
@@ -4485,7 +4485,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
constraints_init_typeinfo();
CTI_INIT = 0;
}
-
+
/* only return for valid types */
if ((type >= CONSTRAINT_TYPE_NULL) &&
(type < NUM_CONSTRAINT_TYPES))
@@ -4496,10 +4496,10 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
else {
printf("No valid constraint type-info data available. Type = %i\n", type);
}
-
+
return NULL;
-}
-
+}
+
/* This function should always be used to get the appropriate type-info, as it
* has checks which prevent segfaults in some weird cases.
*/
@@ -4516,7 +4516,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_get(bConstraint *con)
/* The functions here are called by various parts of Blender. Very few (should be none if possible)
* constraint-specific code should occur here.
*/
-
+
/* ---------- Data Management ------- */
/* helper function for BKE_constraint_free_data() - unlinks references */
@@ -4534,17 +4534,17 @@ void BKE_constraint_free_data_ex(bConstraint *con, bool do_id_user)
{
if (con->data) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
-
+
if (cti) {
/* perform any special freeing constraint may have */
if (cti->free_data)
cti->free_data(con);
-
+
/* unlink the referenced resources it uses */
if (do_id_user && cti->id_looper)
cti->id_looper(con, con_unlink_refs_cb, NULL);
}
-
+
/* free constraint data now */
MEM_freeN(con->data);
}
@@ -4559,11 +4559,11 @@ void BKE_constraint_free_data(bConstraint *con)
void BKE_constraints_free_ex(ListBase *list, bool do_id_user)
{
bConstraint *con;
-
+
/* Free constraint data and also any extra data */
for (con = list->first; con; con = con->next)
BKE_constraint_free_data_ex(con, do_id_user);
-
+
/* Free the whole list */
BLI_freelistN(list);
}
@@ -4619,11 +4619,11 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
if (cti) {
/* initialize constraint data */
con->data = MEM_callocN(cti->size, cti->structName);
-
+
/* only constraints that change any settings need this */
if (cti->new_data)
cti->new_data(con->data);
-
+
/* if no name is provided, use the type of the constraint as the name */
newName = (name && name[0]) ? name : DATA_(cti->name);
}
@@ -4632,10 +4632,10 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
/* NOTE: any constraint type that gets here really shouldn't get added... */
newName = (name && name[0]) ? name : DATA_("Const");
}
-
+
/* copy the name */
BLI_strncpy(con->name, newName, sizeof(con->name));
-
+
/* return the new constraint */
return con;
}
@@ -4645,27 +4645,27 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
{
bConstraint *con;
ListBase *list;
-
+
/* add the constraint */
con = add_new_constraint_internal(name, type);
-
+
/* find the constraint stack - bone or object? */
list = (pchan) ? (&pchan->constraints) : (&ob->constraints);
-
+
if (list) {
/* add new constraint to end of list of constraints before ensuring that it has a unique name
* (otherwise unique-naming code will fail, since it assumes element exists in list)
*/
BLI_addtail(list, con);
BKE_constraint_unique_name(con, list);
-
+
/* if the target list is a list on some PoseChannel belonging to a proxy-protected
* Armature layer, we must tag newly added constraints with a flag which allows them
* to persist after proxy syncing has been done
*/
if (BKE_constraints_proxylocked_owner(ob, pchan))
con->flag |= CONSTRAINT_PROXY_LOCAL;
-
+
/* make this constraint the active one */
BKE_constraints_active_set(list, con);
}
@@ -4684,7 +4684,7 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
break;
}
}
-
+
return con;
}
@@ -4695,7 +4695,7 @@ bConstraint *BKE_constraint_add_for_pose(Object *ob, bPoseChannel *pchan, const
{
if (pchan == NULL)
return NULL;
-
+
return add_new_constraint(ob, pchan, name, type);
}
@@ -4711,10 +4711,10 @@ bConstraint *BKE_constraint_add_for_object(Object *ob, const char *name, short t
void BKE_constraints_id_loop(ListBase *conlist, ConstraintIDFunc func, void *userdata)
{
bConstraint *con;
-
+
for (con = conlist->first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
-
+
if (cti) {
if (cti->id_looper)
cti->id_looper(con, func, userdata);
@@ -4790,7 +4790,7 @@ bConstraint *BKE_constraints_find_name(ListBase *list, const char *name)
bConstraint *BKE_constraints_active_get(ListBase *list)
{
bConstraint *con;
-
+
/* search for the first constraint with the 'active' flag set */
if (list) {
for (con = list->first; con; con = con->next) {
@@ -4798,7 +4798,7 @@ bConstraint *BKE_constraints_active_get(ListBase *list)
return con;
}
}
-
+
/* no active constraint found */
return NULL;
}
@@ -4807,12 +4807,12 @@ bConstraint *BKE_constraints_active_get(ListBase *list)
void BKE_constraints_active_set(ListBase *list, bConstraint *con)
{
bConstraint *c;
-
+
if (list) {
for (c = list->first; c; c = c->next) {
- if (c == con)
+ if (c == con)
c->flag |= CONSTRAINT_ACTIVE;
- else
+ else
c->flag &= ~CONSTRAINT_ACTIVE;
}
}
@@ -4824,11 +4824,11 @@ void BKE_constraints_active_set(ListBase *list, bConstraint *con)
void BKE_constraints_proxylocal_extract(ListBase *dst, ListBase *src)
{
bConstraint *con, *next;
-
+
/* for each tagged constraint, remove from src and move to dst */
for (con = src->first; con; con = next) {
next = con->next;
-
+
/* check if tagged */
if (con->flag & CONSTRAINT_PROXY_LOCAL) {
BLI_remlink(src, con);
@@ -4844,7 +4844,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan)
if (ob && ob->proxy) {
if (ob->pose && pchan) {
bArmature *arm = ob->data;
-
+
/* On bone-level, check if bone is on proxy-protected layer */
if ((pchan->bone) && (pchan->bone->layer & arm->layer_protected))
return true;
@@ -4854,7 +4854,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan)
return true;
}
}
-
+
return false;
}
@@ -4873,7 +4873,7 @@ void BKE_constraint_target_matrix_get(Scene *scene, bConstraint *con, int index,
ListBase targets = {NULL, NULL};
bConstraintOb *cob;
bConstraintTarget *ct;
-
+
if (cti && cti->get_constraint_targets) {
/* make 'constraint-ob' */
cob = MEM_callocN(sizeof(bConstraintOb), "tempConstraintOb");
@@ -4909,19 +4909,19 @@ void BKE_constraint_target_matrix_get(Scene *scene, bConstraint *con, int index,
break;
}
}
-
+
/* get targets - we only need the first one though (and there should only be one) */
cti->get_constraint_targets(con, &targets);
-
+
/* only calculate the target matrix on the first target */
ct = (bConstraintTarget *)BLI_findlink(&targets, index);
-
+
if (ct) {
if (cti->get_target_matrix)
cti->get_target_matrix(con, cob, ct, ctime);
copy_m4_m4(mat, ct->matrix);
}
-
+
/* free targets + 'constraint-ob' */
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
@@ -4937,17 +4937,17 @@ void BKE_constraint_target_matrix_get(Scene *scene, bConstraint *con, int index,
void BKE_constraint_targets_for_solving_get(bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime)
{
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
-
+
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
-
- /* get targets
+
+ /* get targets
* - constraints should use ct->matrix, not directly accessing values
- * - ct->matrix members have not yet been calculated here!
+ * - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, targets);
-
- /* set matrices
+
+ /* set matrices
* - calculate if possible, otherwise just initialize as identity matrix
*/
if (cti->get_target_matrix) {
@@ -4960,7 +4960,7 @@ void BKE_constraint_targets_for_solving_get(bConstraint *con, bConstraintOb *cob
}
}
}
-
+
/* ---------- Evaluation ----------- */
/* This function is called whenever constraints need to be evaluated. Currently, all
@@ -4978,12 +4978,12 @@ void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
/* check that there is a valid constraint object to evaluate */
if (cob == NULL)
return;
-
+
/* loop over available constraints, solving and blending them */
for (con = conlist->first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
-
+
/* these we can skip completely (invalid constraints...) */
if (cti == NULL) continue;
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
@@ -4991,37 +4991,37 @@ void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
if (cti->evaluate_constraint == NULL) continue;
/* influence == 0 should be ignored */
if (con->enforce == 0.0f) continue;
-
+
/* influence of constraint
* - value should have been set from animation data already
*/
enf = con->enforce;
-
+
/* make copy of worldspace matrix pre-constraint for use with blending later */
copy_m4_m4(oldmat, cob->matrix);
-
+
/* move owner matrix into right space */
BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace, false);
-
+
/* prepare targets for constraint solving */
BKE_constraint_targets_for_solving_get(con, cob, &targets, ctime);
-
+
/* Solve the constraint and put result in cob->matrix */
cti->evaluate_constraint(con, cob, &targets);
-
- /* clear targets after use
+
+ /* clear targets after use
* - this should free temp targets but no data should be copied back
* as constraints may have done some nasty things to it...
*/
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 1);
}
-
+
/* move owner back into worldspace for next constraint/other business */
- if ((con->flag & CONSTRAINT_SPACEONCE) == 0)
+ if ((con->flag & CONSTRAINT_SPACEONCE) == 0)
BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD, false);
-
- /* Interpolate the enforcement, to blend result of constraint into final owner transform
+
+ /* Interpolate the enforcement, to blend result of constraint into final owner transform
* - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
* since some constraints may not convert the solution back to the input space before blending
* but all are guaranteed to end up in good "worldspace" result
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 4c01bfd35f2..966abad3739 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -73,7 +73,7 @@ struct bContext {
struct bContextStore *store;
const char *operator_poll_msg; /* reason for poll failing */
} wm;
-
+
/* data context */
struct {
struct Main *main;
@@ -83,7 +83,7 @@ struct bContext {
int py_init; /* true if python is initialized */
void *py_context;
} data;
-
+
/* data evaluation */
#if 0
struct {
@@ -97,7 +97,7 @@ struct bContext {
bContext *CTX_create(void)
{
bContext *C;
-
+
C = MEM_callocN(sizeof(bContext), "bContext");
return C;
@@ -413,7 +413,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
__func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
}
}
-
+
return PointerRNA_NULL;
}
@@ -454,13 +454,13 @@ int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListB
static void data_dir_add(ListBase *lb, const char *member, const bool use_all)
{
LinkData *link;
-
+
if ((use_all == false) && STREQ(member, "scene")) /* exception */
return;
if (BLI_findstring(lb, member, offsetof(LinkData, data)))
return;
-
+
link = MEM_callocN(sizeof(LinkData), "LinkData");
link->data = (void *)member;
BLI_addtail(lb, link);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index d89e7a12644..af978a2b516 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1026,7 +1026,7 @@ static void basisNurb(float t, short order, int pnts, float *knots, float *basis
/* this is for float inaccuracy */
if (t < knots[0])
t = knots[0];
- else if (t > knots[opp2])
+ else if (t > knots[opp2])
t = knots[opp2];
/* this part is order '1' */
@@ -2135,7 +2135,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
if (tilt_array == NULL || nu->tilt_interp != nu->radius_interp) {
key_curve_position_weights(fac, t, nu->radius_interp);
}
- *radius_array =
+ *radius_array =
t[0] * pprev->radius + t[1] * prevbezt->radius +
t[2] * bezt->radius + t[3] * next->radius;
}
@@ -2145,7 +2145,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
if (weight_array) {
/* basic interpolation for now, could copy tilt interp too */
- *weight_array =
+ *weight_array =
prevbezt->weight +
(bezt->weight - prevbezt->weight) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
@@ -2680,10 +2680,10 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
}
for (; nu; nu = nu->next) {
-
+
if (nu->hide && is_editmode)
continue;
-
+
/* check if we will calculate tilt data */
do_tilt = CU_DO_TILT(cu, nu);
do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 023cf76796d..28280c45922 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -544,7 +544,7 @@ static void layerSwap_mdisps(void *data, const int *ci)
for (S = 0; S < corners; S++)
memcpy(d + cornersize * S, s->disps + cornersize * ci[S], cornersize * 3 * sizeof(float));
-
+
MEM_freeN(s->disps);
s->disps = d;
}
@@ -649,7 +649,7 @@ static void layerCopy_grid_paint_mask(const void *source, void *dest, int count)
d[i].data = NULL;
d[i].level = 0;
}
-
+
}
}
@@ -760,7 +760,7 @@ static void layerDoMinMax_mloopcol(const void *data, void *vmin, void *vmax)
if (m->g < min->g) min->g = m->g;
if (m->b < min->b) min->b = m->b;
if (m->a < min->a) min->a = m->a;
-
+
if (m->r > max->r) max->r = m->r;
if (m->g > max->g) max->g = m->g;
if (m->b > max->b) max->b = m->b;
@@ -1023,7 +1023,7 @@ static void layerInterp_mcol(
const float *sub_weight;
if (count <= 0) return;
-
+
sub_weight = sub_weights;
for (i = 0; i < count; ++i) {
float weight = weights ? weights[i] : 1;
@@ -1051,7 +1051,7 @@ static void layerInterp_mcol(
/* delay writing to the destination incase dest is in sources */
for (j = 0; j < 4; ++j) {
-
+
/* Subdivide smooth or fractal can cause problems without clamping
* although weights should also not cause this situation */
mc[j].a = round_fl_to_uchar_clamp(col[j].a);
@@ -1096,7 +1096,7 @@ static void layerInterp_bweight(
float f;
float **in = (float **)sources;
int i;
-
+
if (count <= 0) return;
f = 0.0f;
@@ -1147,7 +1147,7 @@ static void layerDefault_mvert_skin(void *data, int count)
{
MVertSkin *vs = data;
int i;
-
+
for (i = 0; i < count; i++) {
copy_v3_fl(vs[i].radius, 0.25f);
vs[i].flag = 0;
@@ -1234,18 +1234,18 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, layerMaxNum_tface},
/* 16: CD_MLOOPUV */
{sizeof(MLoopUV), "MLoopUV", 1, N_("UVMap"), NULL, NULL, layerInterp_mloopuv, NULL, NULL,
- layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv,
+ layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv,
layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv, NULL, NULL, NULL, layerMaxNum_tface},
/* 17: CD_MLOOPCOL */
{sizeof(MLoopCol), "MLoopCol", 1, N_("Col"), NULL, NULL, layerInterp_mloopcol, NULL,
- layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
+ layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol, NULL, NULL, NULL, layerMaxNum_mloopcol},
/* 18: CD_TANGENT */
{sizeof(float) * 4 * 4, "", 0, N_("Tangent"), NULL, NULL, NULL, NULL, NULL},
/* 19: CD_MDISPS */
{sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
layerFree_mdisps, NULL, layerSwap_mdisps, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps},
/* 20: CD_PREVIEW_MCOL */
{sizeof(MCol) * 4, "MCol", 4, N_("PreviewCol"), NULL, NULL, layerInterp_mcol,
@@ -1488,10 +1488,10 @@ bool CustomData_merge(const struct CustomData *source, struct CustomData *dest,
else {
newlayer = customData_add_layer__internal(dest, type, alloctype, data, totelem, layer->name);
}
-
+
if (newlayer) {
newlayer->uid = layer->uid;
-
+
newlayer->active = lastactive;
newlayer->active_rnd = lastrender;
newlayer->active_clone = lastclone;
@@ -1569,7 +1569,7 @@ void CustomData_free(CustomData *data, int totelem)
if (data->layers)
MEM_freeN(data->layers);
-
+
CustomData_external_free(data);
CustomData_reset(data);
}
@@ -1872,7 +1872,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, int typ
return NULL;
}
}
-
+
data->totlayer++;
/* keep layers ordered by type */
@@ -1902,7 +1902,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, int typ
data->layers[index].active_clone = 0;
data->layers[index].active_mask = 0;
}
-
+
customData_update_offsets(data);
return &data->layers[index];
@@ -1913,7 +1913,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
{
CustomDataLayer *layer;
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
-
+
layer = customData_add_layer__internal(data, type, alloctype, layerdata,
totelem, typeInfo->defaultname);
CustomData_update_typemap(data);
@@ -1929,7 +1929,7 @@ void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
void *layerdata, int totelem, const char *name)
{
CustomDataLayer *layer;
-
+
layer = customData_add_layer__internal(data, type, alloctype, layerdata,
totelem, name);
CustomData_update_typemap(data);
@@ -2014,7 +2014,7 @@ int CustomData_number_of_layers(const CustomData *data, int type)
for (i = 0; i < data->totlayer; i++)
if (data->layers[i].type == type)
number++;
-
+
return number;
}
@@ -2233,7 +2233,7 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
/* if we found a matching layer, copy the data */
if (dest->layers[dest_i].type == source->layers[src_i].type) {
CustomData_copy_data_layer(source, dest, src_i, dest_i, source_index, dest_index, count);
-
+
/* 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
* increment dest_i
@@ -2371,7 +2371,7 @@ void CustomData_swap(struct CustomData *data, const int index_a, const int index
void *CustomData_get(const CustomData *data, int index, int type)
{
int layer_index;
-
+
BLI_assert(index >= 0);
/* get the layer index of the active layer of type */
@@ -2450,9 +2450,9 @@ bool CustomData_set_layer_name(const CustomData *data, int type, int n, const ch
if ((layer_index == -1) || !name)
return false;
-
+
BLI_strncpy(data->layers[layer_index].name, name, sizeof(data->layers[layer_index].name));
-
+
return true;
}
@@ -2852,7 +2852,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
if (*dest_block)
memset(*dest_block, 0, dest->totsize);
}
-
+
/* copies a layer at a time */
dest_i = 0;
for (src_i = 0; src_i < source->totlayer; ++src_i) {
@@ -2894,7 +2894,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
{
int layer_index;
-
+
/* get the layer index of the first layer of type */
layer_index = CustomData_get_active_layer_index(data, type);
if (layer_index == -1) return NULL;
@@ -2905,7 +2905,7 @@ void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int n)
{
int layer_index;
-
+
/* get the layer index of the first layer of type */
layer_index = CustomData_get_layer_index(data, type);
if (layer_index == -1) return NULL;
@@ -2924,13 +2924,13 @@ void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
bool CustomData_layer_has_math(const struct CustomData *data, int layer_n)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
-
- if (typeInfo->equal && typeInfo->add && typeInfo->multiply &&
+
+ if (typeInfo->equal && typeInfo->add && typeInfo->multiply &&
typeInfo->initminmax && typeInfo->dominmax)
{
return true;
}
-
+
return false;
}
@@ -3203,7 +3203,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
if (*dest_block == NULL)
CustomData_bmesh_alloc_block(dest, dest_block);
-
+
/* copies a layer at a time */
dest_i = 0;
for (src_i = 0; src_i < source->totlayer; ++src_i) {
@@ -3405,7 +3405,7 @@ static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int
for (i = 0; i < data->totlayer; i++) {
if (i != index) {
CustomDataLayer *layer = &data->layers[i];
-
+
if (CustomData_is_property_layer(type)) {
if (CustomData_is_property_layer(layer->type) && STREQ(layer->name, name)) {
return true;
@@ -3418,7 +3418,7 @@ static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int
}
}
}
-
+
return false;
}
@@ -3429,7 +3429,7 @@ static bool customdata_unique_check(void *arg, const char *name)
}
void CustomData_set_layer_unique_name(CustomData *data, int index)
-{
+{
CustomDataLayer *nlayer = &data->layers[index];
const LayerTypeInfo *typeInfo = layerType_getInfo(nlayer->type);
@@ -3535,7 +3535,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
if (!external)
return;
-
+
for (i = 0; i < data->totlayer; i++) {
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index d17c9ef5cc6..aa762865a2a 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -115,7 +115,7 @@ static int cdf_data_type_size(int datatype)
{
if (datatype == CDF_DATA_FLOAT)
return sizeof(float);
-
+
return 0;
}
#endif
@@ -156,7 +156,7 @@ static int cdf_read_header(CDataFile *cdf)
if (!fread(header, sizeof(CDataFileHeader), 1, cdf->readf))
return 0;
-
+
if (memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0)
return 0;
if (header->version > CDF_VERSION)
@@ -179,7 +179,7 @@ static int cdf_read_header(CDataFile *cdf)
if (fseek(f, offset, SEEK_SET) != 0)
return 0;
-
+
if (header->type == CDF_TYPE_IMAGE) {
image = &cdf->btype.image;
if (!fread(image, sizeof(CDataFileImageHeader), 1, f))
@@ -258,7 +258,7 @@ static int cdf_write_header(CDataFile *cdf)
if (!fwrite(header, sizeof(CDataFileHeader), 1, f))
return 0;
-
+
if (header->type == CDF_TYPE_IMAGE) {
image = &cdf->btype.image;
if (!fwrite(image, sizeof(CDataFileImageHeader), 1, f))
@@ -287,7 +287,7 @@ bool cdf_read_open(CDataFile *cdf, const char *filename)
f = BLI_fopen(filename, "rb");
if (!f)
return 0;
-
+
cdf->readf = f;
if (!cdf_read_header(cdf)) {
@@ -352,7 +352,7 @@ bool cdf_write_open(CDataFile *cdf, const char *filename)
f = BLI_fopen(filename, "wb");
if (!f)
return 0;
-
+
cdf->writef = f;
/* fill header */
@@ -424,7 +424,7 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name)
if (layer->type == type && STREQ(layer->name, name))
return layer;
}
-
+
return NULL;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 78f564e5e5e..734aac8a1f7 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -27,7 +27,7 @@
* \ingroup bke
*/
-
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -115,7 +115,7 @@ void DAG_exit(void)
DEG_free_node_types();
}
-/* Queue and stack operations for dag traversal
+/* Queue and stack operations for dag traversal
*
* the queue store a list of freenodes to avoid successive alloc/dealloc
*/
@@ -125,7 +125,7 @@ DagNodeQueue *queue_create(int slots)
DagNodeQueue *queue;
DagNodeQueueElem *elem;
int i;
-
+
queue = MEM_mallocN(sizeof(DagNodeQueue), "DAG queue");
queue->freenodes = MEM_mallocN(sizeof(DagNodeQueue), "DAG queue");
queue->count = 0;
@@ -135,7 +135,7 @@ DagNodeQueue *queue_create(int slots)
elem->node = NULL;
elem->next = NULL;
queue->freenodes->first = queue->freenodes->last = elem;
-
+
for (i = 1; i < slots; i++) {
elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem4");
elem->node = NULL;
@@ -150,13 +150,13 @@ DagNodeQueue *queue_create(int slots)
void queue_raz(DagNodeQueue *queue)
{
DagNodeQueueElem *elem;
-
+
elem = queue->first;
if (queue->freenodes->last)
queue->freenodes->last->next = elem;
else
queue->freenodes->first = queue->freenodes->last = elem;
-
+
elem->node = NULL;
queue->freenodes->count++;
while (elem->next) {
@@ -172,21 +172,21 @@ void queue_delete(DagNodeQueue *queue)
{
DagNodeQueueElem *elem;
DagNodeQueueElem *temp;
-
+
elem = queue->first;
while (elem) {
temp = elem;
elem = elem->next;
MEM_freeN(temp);
}
-
+
elem = queue->freenodes->first;
while (elem) {
temp = elem;
elem = elem->next;
MEM_freeN(temp);
}
-
+
MEM_freeN(queue->freenodes);
MEM_freeN(queue);
}
@@ -226,7 +226,7 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
queue->freenodes->last = elem;
}
queue->freenodes->count = DAGQUEUEALLOC;
-
+
elem = queue->freenodes->first;
queue->freenodes->first = elem->next;
}
@@ -271,7 +271,7 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
queue->freenodes->last = elem;
}
queue->freenodes->count = DAGQUEUEALLOC;
-
+
elem = queue->freenodes->first;
queue->freenodes->first = elem->next;
}
@@ -334,25 +334,25 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
{
FCurve *fcu;
DagNode *node1;
-
+
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
int isdata_fcu = (isdata) || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
-
+
/* loop over variables to get the target relationships */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
/* only used targets */
- DRIVER_TARGETS_USED_LOOPER(dvar)
+ DRIVER_TARGETS_USED_LOOPER(dvar)
{
if (dtar->id) {
/* FIXME: other data types need to be added here so that they can work! */
if (GS(dtar->id->name) == ID_OB) {
Object *ob = (Object *)dtar->id;
-
+
/* normal channel-drives-channel */
node1 = dag_get_node(dag, dtar->id);
-
+
/* check if bone... */
if ((ob->type == OB_ARMATURE) &&
( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) ||
@@ -386,7 +386,7 @@ static void dag_add_shader_nodetree_driver_relations(DagForest *dag, DagNode *no
if (ntree->adt) {
dag_add_driver_relation(ntree->adt, dag, node, 1);
}
-
+
/* nodetree's nodes... */
for (n = ntree->nodes.first; n; n = n->next) {
if (n->id) {
@@ -403,7 +403,7 @@ static void dag_add_shader_nodetree_driver_relations(DagForest *dag, DagNode *no
/* recursive handling for material drivers */
static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma)
{
- /* Prevent infinite recursion by checking (and tagging the material) as having been visited
+ /* Prevent infinite recursion by checking (and tagging the material) as having been visited
* already (see build_dag()). This assumes ma->id.tag & LIB_TAG_DOIT isn't set by anything else
* in the meantime... [#32017]
*/
@@ -411,7 +411,7 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
return;
ma->id.tag |= LIB_TAG_DOIT;
-
+
/* material itself */
if (ma->adt)
dag_add_driver_relation(ma->adt, dag, node, 1);
@@ -430,7 +430,7 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
/* recursive handling for lamp drivers */
static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *la)
{
- /* Prevent infinite recursion by checking (and tagging the lamp) as having been visited
+ /* Prevent infinite recursion by checking (and tagging the lamp) as having been visited
* already (see build_dag()). This assumes la->id.tag & LIB_TAG_DOIT isn't set by anything else
* in the meantime... [#32017]
*/
@@ -438,7 +438,7 @@ static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *l
return;
la->id.tag |= LIB_TAG_DOIT;
-
+
/* lamp itself */
if (la->adt)
dag_add_driver_relation(la->adt, dag, node, 1);
@@ -554,9 +554,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
Key *key;
ParticleSystem *psys;
int addtoroot = 1;
-
+
node = dag_get_node(dag, ob);
-
+
if ((ob->data) && (mask & DAG_RL_DATA)) {
node2 = dag_get_node(dag, ob->data);
dag_add_relation(dag, node, node2, DAG_RL_DATA, "Object-Data Relation");
@@ -565,11 +565,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
/* also build a custom data mask for dependencies that need certain layers */
-
+
if (ob->type == OB_ARMATURE) {
if (ob->pose) {
bPoseChannel *pchan;
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
@@ -585,12 +585,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
else if (cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar && ct->tar != ob) {
// fprintf(stderr, "armature %s target :%s\n", ob->id.name, target->id.name);
node3 = dag_get_node(dag, ct->tar);
-
+
if (ct->subtarget[0]) {
dag_add_relation(dag, node3, node, DAG_RL_OB_DATA | DAG_RL_DATA_DATA, cti->name);
if (ct->tar->type == OB_MESH)
@@ -608,16 +608,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
}
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
}
-
+
}
}
}
}
-
+
/* driver dependencies, nla modifiers */
#if 0 // XXX old animation system
if (ob->nlastrips.first) {
@@ -638,7 +638,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
#endif // XXX old animation system
if (ob->adt)
dag_add_driver_relation(ob->adt, dag, node, (ob->type == OB_ARMATURE)); // XXX isdata arg here doesn't give an accurate picture of situation
-
+
key = BKE_key_from_object(ob);
if (key && key->adt)
dag_add_driver_relation(key->adt, dag, node, 1);
@@ -654,13 +654,13 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
};
for (md = ob->modifiers.first; md; md = md->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
+
if (mti->updateDepgraph) mti->updateDepgraph(md, &ctx);
}
}
if (ob->parent) {
node2 = dag_get_node(dag, ob->parent);
-
+
switch (ob->partype) {
case PARSKEL:
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_OB, "Parent");
@@ -677,7 +677,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_OB, "Lattice Parent");
else if (ob->parent->type == OB_CURVE) {
Curve *cu = ob->parent->data;
- if (cu->flag & CU_PATH)
+ if (cu->flag & CU_PATH)
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB | DAG_RL_OB_OB, "Curve Parent");
else
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Curve Parent");
@@ -690,7 +690,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (ob->type == OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_OB, "Duplivert");
}
-
+
addtoroot = 0;
}
if (ob->proxy) {
@@ -698,7 +698,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_OB, "Proxy");
/* inverted relation, so addtoroot shouldn't be set to zero */
}
-
+
if (ob->transflag & OB_DUPLI) {
if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
GroupObject *go;
@@ -725,23 +725,23 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (adt)
dag_add_driver_relation(adt, dag, node, 1);
}
-
+
/* object type/data relationships */
switch (ob->type) {
case OB_CAMERA:
{
Camera *cam = (Camera *)ob->data;
-
+
if (cam->dof_ob) {
node2 = dag_get_node(dag, cam->dof_ob);
dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Camera DoF");
}
break;
}
- case OB_MBALL:
+ case OB_MBALL:
{
Object *mom = BKE_mball_basis_find(G.main, G.main->eval_ctx, scene, ob);
-
+
if (mom != ob) {
node2 = dag_get_node(dag, mom);
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball"); /* mom depends on children! */
@@ -752,7 +752,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
case OB_FONT:
{
Curve *cu = ob->data;
-
+
if (cu->bevobj) {
node2 = dag_get_node(dag, cu->bevobj);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Curve Bevel");
@@ -795,14 +795,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
break;
}
}
-
+
/* material drivers */
if (ob->totcol) {
int a;
-
+
for (a = 1; a <= ob->totcol; a++) {
Material *ma = give_current_material(ob, a);
-
+
if (ma) {
/* recursively figure out if there are drivers, and hook these up to this object */
dag_add_material_driver_relations(dag, node, ma);
@@ -812,7 +812,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
else if (ob->type == OB_LAMP) {
dag_add_lamp_driver_relations(dag, node, ob->data);
}
-
+
/* particles */
psys = ob->particlesystem.first;
if (psys) {
@@ -889,13 +889,13 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
}
}
-
+
/* object constraints */
for (con = ob->constraints.first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
-
+
if (!cti)
continue;
@@ -905,15 +905,15 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
else if (cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
Object *obt;
-
+
if (ct->tar)
obt = ct->tar;
else
continue;
-
+
node2 = dag_get_node(dag, obt);
if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO))
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB | DAG_RL_OB_OB, cti->name);
@@ -932,7 +932,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
addtoroot = 0;
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
}
@@ -948,7 +948,7 @@ static void build_dag_group(DagForest *dag, DagNode *scenenode, Main *bmain, Sce
if (group->id.tag & LIB_TAG_DOIT)
return;
-
+
group->id.tag |= LIB_TAG_DOIT;
for (go = group->gobject.first; go; go = go->next) {
@@ -982,10 +982,10 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
BKE_main_id_tag_idcode(bmain, ID_MA, LIB_TAG_DOIT, false);
BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, false);
BKE_main_id_tag_idcode(bmain, ID_GR, LIB_TAG_DOIT, false);
-
+
/* add base node for scene. scene is always the first node in DAG */
scenenode = dag_add_node(dag, sce);
-
+
/* add current scene objects */
for (base = sce->base.first; base; base = base->next) {
ob = base->object;
@@ -993,7 +993,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
build_dag_object(dag, scenenode, sce, ob, mask);
if (ob->proxy)
build_dag_object(dag, scenenode, sce, ob->proxy, mask);
- if (ob->dup_group)
+ if (ob->dup_group)
build_dag_group(dag, scenenode, bmain, sce, ob->dup_group, mask);
}
@@ -1027,11 +1027,11 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
}
BKE_main_id_tag_idcode(bmain, ID_GR, LIB_TAG_DOIT, false);
-
+
/* Now all relations were built, but we need to solve 1 exceptional case;
* When objects have multiple "parents" (for example parent + constraint working on same object)
* the relation type has to be synced. One of the parents can change, and should give same event to child */
-
+
/* nodes were callocced, so we can use node->color for temporal storage */
for (node = sce->theDag->DagNode.first; node; node = node->next) {
if (node->type == ID_OB) {
@@ -1059,21 +1059,21 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
}
}
}
-
+
/* cycle detection and solving */
// solve_cycles(dag);
-
+
return dag;
}
-void free_forest(DagForest *Dag)
+void free_forest(DagForest *Dag)
{ /* remove all nodes and deps */
DagNode *tempN;
DagAdjList *tempA;
DagAdjList *itA;
DagNode *itN = Dag->DagNode.first;
-
+
while (itN) {
itA = itN->child;
while (itA) {
@@ -1081,14 +1081,14 @@ void free_forest(DagForest *Dag)
itA = itA->next;
MEM_freeN(tempA);
}
-
+
itA = itN->parent;
while (itA) {
tempA = itA;
itA = itA->next;
MEM_freeN(tempA);
}
-
+
tempN = itN;
itN = itN->next;
MEM_freeN(tempN);
@@ -1116,7 +1116,7 @@ static int dag_print_dependencies = 0; /* debugging */
DagNode *dag_add_node(DagForest *forest, void *fob)
{
DagNode *node;
-
+
node = MEM_callocN(sizeof(DagNode), "DAG node");
if (node) {
node->ob = fob;
@@ -1145,9 +1145,9 @@ DagNode *dag_add_node(DagForest *forest, void *fob)
DagNode *dag_get_node(DagForest *forest, void *fob)
{
DagNode *node;
-
+
node = dag_find_node(forest, fob);
- if (!node)
+ if (!node)
node = dag_add_node(forest, fob);
return node;
}
@@ -1158,7 +1158,7 @@ DagNode *dag_get_sub_node(DagForest *forest, void *fob)
{
DagNode *node;
DagAdjList *mainchild, *prev = NULL;
-
+
mainchild = ((DagNode *) forest->DagNode.first)->child;
/* remove from first node (scene) adj list if present */
while (mainchild) {
@@ -1178,15 +1178,15 @@ DagNode *dag_get_sub_node(DagForest *forest, void *fob)
mainchild = mainchild->next;
}
node = dag_find_node(forest, fob);
- if (!node)
+ if (!node)
node = dag_add_node(forest, fob);
return node;
}
-static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, const char *name)
+static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, const char *name)
{
DagAdjList *itA = fob2->parent;
-
+
while (itA) { /* search if relation exist already */
if (itA->node == fob1) {
itA->type |= rel;
@@ -1205,10 +1205,10 @@ static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, Da
fob2->parent = itA;
}
-void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name)
+void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name)
{
DagAdjList *itA = fob1->child;
-
+
/* parent relation is for cycle checking */
dag_add_parent_relation(forest, fob1, fob2, rel, name);
@@ -1309,7 +1309,7 @@ static int dag_node_recurs_level(DagNode *node, int level)
node->color = DAG_BLACK; /* done */
newlevel = ++level;
-
+
for (itA = node->parent; itA; itA = itA->next) {
if (itA->node->color == DAG_WHITE) {
itA->node->ancestor_count = dag_node_recurs_level(itA->node, level);
@@ -1318,7 +1318,7 @@ static int dag_node_recurs_level(DagNode *node, int level)
else
newlevel = MAX2(newlevel, level + itA->node->ancestor_count);
}
-
+
return newlevel;
}
@@ -1337,13 +1337,13 @@ static void dag_check_cycle(DagForest *dag)
/* tag nodes unchecked */
for (node = dag->DagNode.first; node; node = node->next)
node->color = DAG_WHITE;
-
+
for (node = dag->DagNode.first; node; node = node->next) {
if (node->color == DAG_WHITE) {
node->ancestor_count = dag_node_recurs_level(node, 0);
}
}
-
+
/* check relations, and print errors */
for (node = dag->DagNode.first; node; node = node->next) {
for (itA = node->parent; itA; itA = itA->next) {
@@ -1370,9 +1370,9 @@ static void dag_check_cycle(DagForest *dag)
/* debug test functions */
void graph_print_queue(DagNodeQueue *nqueue)
-{
+{
DagNodeQueueElem *queueElem;
-
+
queueElem = nqueue->first;
while (queueElem) {
fprintf(stderr, "** %s %i %i-%i ", ((ID *) queueElem->node->ob)->name, queueElem->node->color, queueElem->node->DFS_dvtm, queueElem->node->DFS_fntm);
@@ -1382,10 +1382,10 @@ void graph_print_queue(DagNodeQueue *nqueue)
}
void graph_print_queue_dist(DagNodeQueue *nqueue)
-{
+{
DagNodeQueueElem *queueElem;
int count;
-
+
queueElem = nqueue->first;
count = 0;
while (queueElem) {
@@ -1405,14 +1405,14 @@ void graph_print_adj_list(DagForest *dag)
{
DagNode *node;
DagAdjList *itA;
-
+
node = dag->DagNode.first;
while (node) {
fprintf(stderr, "node : %s col: %i", ((ID *) node->ob)->name, node->color);
itA = node->child;
while (itA) {
fprintf(stderr, "-- %s ", ((ID *) itA->node->ob)->name);
-
+
itA = itA->next;
}
fprintf(stderr, "\n");
@@ -1474,14 +1474,14 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
Group *group;
GroupObject *go;
Object *ob;
-
+
/* test; are group objects all in this scene? */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
ob->id.tag &= ~LIB_TAG_DOIT;
}
for (base = sce->base.first; base; base = base->next)
base->object->id.tag |= LIB_TAG_DOIT;
-
+
for (group = bmain->group.first; group; group = group->id.next) {
for (go = group->gobject.first; go; go = go->next) {
if ((go->ob->id.tag & LIB_TAG_DOIT) == 0)
@@ -1490,13 +1490,13 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
/* this group is entirely in this scene */
if (go == NULL) {
ListBase listb = {NULL, NULL};
-
+
for (go = group->gobject.first; go; go = go->next)
go->ob->id.newid = (ID *)go;
-
+
/* in order of sorted bases we reinsert group objects */
for (base = sce->base.first; base; base = base->next) {
-
+
if (base->object->id.newid) {
go = (GroupObject *)base->object->id.newid;
base->object->id.newid = NULL;
@@ -1668,29 +1668,29 @@ static void dag_scene_build(Main *bmain, Scene *sce)
dag_check_cycle(sce->theDag);
nqueue = queue_create(DAGQUEUEALLOC);
-
+
for (node = sce->theDag->DagNode.first; node; node = node->next) {
node->color = DAG_WHITE;
}
-
+
time = 1;
-
+
rootnode = sce->theDag->DagNode.first;
rootnode->color = DAG_GRAY;
time++;
push_stack(nqueue, rootnode);
-
+
while (nqueue->count) {
-
+
skip = 0;
node = get_top_node_queue(nqueue);
-
+
itA = node->child;
while (itA != NULL) {
if (itA->node->color == DAG_WHITE) {
itA->node->DFS_dvtm = time;
itA->node->color = DAG_GRAY;
-
+
time++;
push_stack(nqueue, itA->node);
skip = 1;
@@ -1698,14 +1698,14 @@ static void dag_scene_build(Main *bmain, Scene *sce)
}
itA = itA->next;
}
-
+
if (!skip) {
if (node) {
node = pop_queue(nqueue);
if (node->ob == sce) /* we are done */
break;
node->color = DAG_BLACK;
-
+
time++;
base = sce->base.first;
while (base && base->object != node->ob)
@@ -1717,7 +1717,7 @@ static void dag_scene_build(Main *bmain, Scene *sce)
}
}
}
-
+
/* temporal correction for circular dependencies */
base = sce->base.first;
while (base) {
@@ -1727,13 +1727,13 @@ static void dag_scene_build(Main *bmain, Scene *sce)
printf("cyclic %s\n", base->object->id.name);
base = sce->base.first;
}
-
+
sce->base = tempbase;
queue_delete(nqueue);
-
+
/* all groups with objects in this scene gets resorted too */
scene_sort_groups(bmain, sce);
-
+
if (G.debug & G_DEBUG) {
printf("\nordered\n");
for (base = sce->base.first; base; base = base->next) {
@@ -1833,9 +1833,9 @@ static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, in
int oldflag;
bool changed = false;
unsigned int all_layer;
-
+
node->lasttime = curtime;
-
+
ob = node->ob;
if (ob && (ob->recalc & OB_RECALC_ALL)) {
all_layer = node->scelay;
@@ -1848,7 +1848,7 @@ static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, in
if (itA->node->type == ID_OB) {
obc = itA->node->ob;
oldflag = obc->recalc;
-
+
/* got a ob->obc relation, now check if flag needs flush */
if (ob->recalc & OB_RECALC_OB) {
if (itA->type & DAG_RL_OB_OB) {
@@ -1883,11 +1883,11 @@ static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, in
/* but existing displaylists or derivedmesh should be freed */
if (ob->recalc & OB_RECALC_DATA)
BKE_object_free_derived_caches(ob);
-
+
ob->recalc &= ~OB_RECALC_ALL;
}
}
-
+
/* check case where child changes and parent forcing obdata to change */
/* should be done regardless if this ob has recalc set */
/* could merge this in with loop above...? (ton) */
@@ -1908,23 +1908,23 @@ static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, in
}
}
}
-
+
/* we only go deeper if node not checked or something changed */
for (itA = node->child; itA; itA = itA->next) {
if (changed || itA->node->lasttime != curtime)
flush_update_node(bmain, itA->node, layer, curtime);
}
-
+
}
/* node was checked to have lasttime != curtime, and is of type ID_OB */
static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
{
DagAdjList *itA;
-
+
node->lasttime = curtime;
node->lay = node->scelay;
-
+
for (itA = node->child; itA; itA = itA->next) {
if (itA->node->type == ID_OB) {
if (itA->node->lasttime != curtime) {
@@ -1933,7 +1933,7 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
else {
itA->lay = itA->node->lay;
}
-
+
node->lay |= itA->lay;
}
}
@@ -1947,9 +1947,9 @@ static void flush_pointcache_reset(Main *bmain, Scene *scene, DagNode *node,
{
DagAdjList *itA;
Object *ob;
-
+
node->lasttime = curtime;
-
+
for (itA = node->child; itA; itA = itA->next) {
if (itA->node->type == ID_OB) {
if (itA->node->lasttime != curtime) {
@@ -2029,12 +2029,12 @@ static void dag_tag_renderlayers(Scene *sce, unsigned int lay)
bNode *node;
Base *base;
unsigned int lay_changed = 0;
-
+
for (base = sce->base.first; base; base = base->next)
if (base->lay & lay)
if (base->object->recalc)
lay_changed |= base->lay;
-
+
for (node = sce->nodetree->nodes.first; node; node = node->next) {
if (node->id == (ID *)sce) {
SceneRenderLayer *srl = BLI_findlink(&sce->r.layers, node->custom1);
@@ -2062,7 +2062,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
printf("DAG zero... not allowed to happen!\n");
DAG_scene_relations_update(bmain, sce);
}
-
+
firstnode = sce->theDag->DagNode.first; /* always scene node */
/* first we flush the layer flags */
@@ -2098,14 +2098,14 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
}
}
}
-
+
dag_tag_renderlayers(sce, lay);
}
static bool modifier_nlastrips_use_time(ListBase *strips)
{
NlaStrip *strip;
-
+
if (strips) {
for (strip = strips->first; strip; strip = strip->next) {
if (modifier_nlastrips_use_time(&strip->strips)) {
@@ -2113,7 +2113,7 @@ static bool modifier_nlastrips_use_time(ListBase *strips)
}
else if (strip->act) {
FCurve *fcu;
-
+
for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) {
if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
return true;
@@ -2121,26 +2121,26 @@ static bool modifier_nlastrips_use_time(ListBase *strips)
}
}
}
-
+
return false;
}
static bool object_modifiers_use_time(Object *ob)
{
ModifierData *md;
-
+
/* check if a modifier in modifier stack needs time input */
for (md = ob->modifiers.first; md; md = md->next) {
if (modifier_dependsOnTime(md))
return true;
}
-
+
/* check whether any modifiers are animated */
if (ob->adt) {
AnimData *adt = ob->adt;
NlaTrack *nlt;
FCurve *fcu;
-
+
/* action - check for F-Curves with paths containing 'modifiers[' */
if (adt->action) {
for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
@@ -2148,7 +2148,7 @@ static bool object_modifiers_use_time(Object *ob)
return true;
}
}
-
+
/* This here allows modifier properties to get driven and still update properly
*
* Workaround to get [#26764] (e.g. subsurf levels not updating when animated/driven)
@@ -2159,40 +2159,40 @@ static bool object_modifiers_use_time(Object *ob)
if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
return true;
}
-
+
/* Also check NLA Strips... [#T45938] */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
if (modifier_nlastrips_use_time(&nlt->strips))
return true;
}
}
-
+
return false;
}
static short animdata_use_time(AnimData *adt)
{
NlaTrack *nlt;
-
+
if (adt == NULL) return 0;
-
+
/* check action - only if assigned, and it has anim curves */
if (adt->action && adt->action->curves.first)
return 1;
-
+
/* check NLA tracks + strips */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
if (nlt->strips.first)
return 1;
}
-
+
/* If we have drivers, more likely than not, on a frame change
* they'll need updating because their owner changed
- *
+ *
* This is kindof a hack to get around a whole host of problems
- * involving drivers using non-object datablock data (which the
+ * involving drivers using non-object datablock data (which the
* depsgraph currently has no way of representing let alone correctly
- * dependency sort+tagging). By doing this, at least we ensure that
+ * dependency sort+tagging). By doing this, at least we ensure that
* some commonly attempted drivers (such as scene -> current frame;
* see "Driver updates fail" thread on Bf-committers dated July 2)
* will work correctly, and that other non-object datablocks will have
@@ -2202,7 +2202,7 @@ static short animdata_use_time(AnimData *adt)
*/
if (adt->drivers.first)
return 1;
-
+
return 0;
}
@@ -2214,7 +2214,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
-
+
if (cti) {
/* special case for camera tracking -- it doesn't use targets to define relations */
if (ELEM(cti->type,
@@ -2227,27 +2227,27 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
}
else if (cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar) {
ob->recalc |= OB_RECALC_OB;
break;
}
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
}
-
+
}
}
}
-
+
if (ob->parent) {
/* motion path or bone child */
if (ob->parent->type == OB_CURVE || ob->parent->type == OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
}
-
+
#if 0 // XXX old animation system
if (ob->nlastrips.first) {
if (ob->dup_group) {
@@ -2260,27 +2260,27 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
}
}
#endif // XXX old animation system
-
+
if (animdata_use_time(ob->adt)) {
ob->recalc |= OB_RECALC_OB;
ob->adt->recalc |= ADT_RECALC_ANIM;
}
-
+
if ((ob->adt) && (ob->type == OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
-
+
if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
-
+
// XXX: scene here may not be the scene that contains the rigidbody world affecting this!
if (ob->rigidbody_object && BKE_scene_check_rigidbody_active(scene))
ob->recalc |= OB_RECALC_OB;
-
+
{
AnimData *adt = BKE_animdata_from_id((ID *)ob->data);
Mesh *me;
Curve *cu;
Lattice *lt;
-
+
switch (ob->type) {
case OB_MESH:
me = ob->data;
@@ -2334,7 +2334,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
ob->recalc |= OB_RECALC_DATA;
break;
}
-
+
if (animdata_use_time(adt)) {
ob->recalc |= OB_RECALC_DATA;
adt->recalc |= ADT_RECALC_ANIM;
@@ -2366,7 +2366,7 @@ static void dag_group_update_flags(Main *bmain, Scene *scene, Group *group, cons
if (group->id.tag & LIB_TAG_DOIT)
return;
-
+
group->id.tag |= LIB_TAG_DOIT;
for (go = group->gobject.first; go; go = go->next) {
@@ -2396,9 +2396,9 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const b
if (do_time) {
/* now if DagNode were part of base, the node->lay could be checked... */
/* we do all now, since the scene_flush checks layers and clears recalc flags even */
-
- /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work
- * (i.e. muting + rbw availability can be checked and tagged properly) [#33970]
+
+ /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work
+ * (i.e. muting + rbw availability can be checked and tagged properly) [#33970]
*/
dag_object_time_update_flags(bmain, sce_iter, ob);
}
@@ -2410,7 +2410,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const b
for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set)
DAG_scene_flush_update(bmain, sce_iter, lay, 1);
-
+
if (do_time) {
/* test: set time flag, to disable baked systems to update */
for (SETLOOPER(scene, sce_iter, base)) {
@@ -2452,12 +2452,12 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
{
wmWindowManager *wm;
wmWindow *win;
-
+
BLI_listbase_clear(lb);
/* if we have a windowmanager, look into windows */
if ((wm = bmain->wm.first)) {
-
+
BKE_main_id_flag_listbase(&bmain->scene, LIB_TAG_DOIT, 1);
for (win = wm->windows.first; win; win = win->next) {
@@ -2499,9 +2499,9 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
else {
/* if not, use the first sce */
DagSceneLayer *dsl = MEM_mallocN(sizeof(DagSceneLayer), "dag scene layer");
-
+
BLI_addtail(lb, dsl);
-
+
dsl->scene = bmain->scene.first;
dsl->layer = dsl->scene->lay;
@@ -2517,7 +2517,7 @@ static void dag_group_on_visible_update(Scene *scene, Group *group)
if (group->id.tag & LIB_TAG_DOIT)
return;
-
+
group->id.tag |= LIB_TAG_DOIT;
for (go = group->gobject.first; go; go = go->next) {
@@ -2550,7 +2550,7 @@ void DAG_on_visible_update(Main *bmain, const bool do_time)
/* get list of visible scenes and layers */
dag_current_scene_layers(bmain, &listbase);
-
+
for (dsl = listbase.first; dsl; dsl = dsl->next) {
Scene *scene = dsl->scene;
Scene *sce_iter;
@@ -2603,7 +2603,7 @@ void DAG_on_visible_update(Main *bmain, const bool do_time)
DAG_scene_update_flags(bmain, scene, lay, do_time, true);
scene->lay_updated |= lay;
}
-
+
BLI_freelistN(&listbase);
/* hack to get objects updating on layer changes */
@@ -2623,7 +2623,7 @@ static void dag_id_flush_update__isDependentTexture(
void *userData, Object *UNUSED(ob), ID **idpoin, int UNUSED(cb_flag))
{
struct { ID *id; bool is_dependent; } *data = userData;
-
+
if (*idpoin && GS((*idpoin)->name) == ID_TE) {
if (data->id == (*idpoin))
data->is_dependent = 1;
@@ -2726,7 +2726,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id)
}
}
}
-
+
/* set flags based on ShapeKey */
if (idtype == ID_KE) {
for (obt = bmain->object.first; obt; obt = obt->id.next) {
@@ -2739,7 +2739,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id)
}
}
}
-
+
/* set flags based on particle settings */
if (idtype == ID_PA) {
ParticleSystem *psys;
@@ -2863,7 +2863,7 @@ void DAG_ids_flush_tagged(Main *bmain)
if (id->recalc & ID_RECALC_ALL) {
for (dsl = listbase.first; dsl; dsl = dsl->next)
dag_id_flush_update(bmain, dsl->scene, id);
-
+
do_flush = true;
}
}
@@ -2875,7 +2875,7 @@ void DAG_ids_flush_tagged(Main *bmain)
for (dsl = listbase.first; dsl; dsl = dsl->next)
DAG_scene_flush_update(bmain, dsl->scene, dsl->layer, 0);
}
-
+
BLI_freelistN(&listbase);
}
@@ -3112,28 +3112,28 @@ int DAG_id_type_tagged(Main *bmain, short idtype)
static int parent_check_node(DagNode *node, int curtime)
{
DagAdjList *itA;
-
+
node->lasttime = curtime;
-
+
if (node->color == DAG_GRAY)
return DAG_GRAY;
-
+
for (itA = node->child; itA; itA = itA->next) {
if (itA->node->type == ID_OB) {
-
+
if (itA->node->color == DAG_GRAY)
return DAG_GRAY;
/* descend if not done */
if (itA->node->lasttime != curtime) {
itA->node->color = parent_check_node(itA->node, curtime);
-
+
if (itA->node->color == DAG_GRAY)
return DAG_GRAY;
}
}
}
-
+
return DAG_WHITE;
}
#endif
@@ -3154,18 +3154,18 @@ void DAG_pose_sort(Object *ob)
DagAdjList *itA;
ListBase tempbase;
int skip = 0;
-
+
dag = dag_init();
dag->ugly_hack_sorry = false; /* no ID structs */
rootnode = dag_add_node(dag, NULL); /* node->ob becomes NULL */
-
+
/* we add the hierarchy and the constraints */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
int addtoroot = 1;
-
+
node = dag_get_node(dag, pchan);
-
+
if (pchan->parent) {
node2 = dag_get_node(dag, pchan->parent);
dag_add_relation(dag, node2, node, 0, "Parent Relation");
@@ -3175,33 +3175,33 @@ void DAG_pose_sort(Object *ob)
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
-
+
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar == ob && ct->subtarget[0]) {
bPoseChannel *target = BKE_pose_channel_find_name(ob->pose, ct->subtarget);
if (target) {
node2 = dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "Pose Constraint");
-
+
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
bPoseChannel *parchan;
int segcount = 0;
-
+
/* exclude tip from chain? */
if (!(data->flag & CONSTRAINT_IK_TIP))
parchan = pchan->parent;
else
parchan = pchan;
-
+
/* Walk to the chain's root */
while (parchan) {
node3 = dag_get_node(dag, parchan);
dag_add_relation(dag, node2, node3, 0, "IK Constraint");
-
+
segcount++;
if (segcount == data->rootbone || segcount > 255) break; /* 255 is weak */
parchan = parchan->parent;
@@ -3210,7 +3210,7 @@ void DAG_pose_sort(Object *ob)
}
}
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
}
@@ -3221,24 +3221,24 @@ void DAG_pose_sort(Object *ob)
}
dag_check_cycle(dag);
-
+
/* now we try to sort... */
BLI_listbase_clear(&tempbase);
nqueue = queue_create(DAGQUEUEALLOC);
-
+
/* tag nodes unchecked */
for (node = dag->DagNode.first; node; node = node->next)
node->color = DAG_WHITE;
-
+
rootnode->color = DAG_GRAY;
- push_stack(nqueue, rootnode);
-
+ push_stack(nqueue, rootnode);
+
while (nqueue->count) {
-
+
skip = 0;
node = get_top_node_queue(nqueue);
-
+
itA = node->child;
while (itA != NULL) {
if (itA->node->color == DAG_WHITE) {
@@ -3249,21 +3249,21 @@ void DAG_pose_sort(Object *ob)
}
itA = itA->next;
}
-
+
if (!skip) {
if (node) {
node = pop_queue(nqueue);
if (node->ob == NULL) /* we are done */
break;
node->color = DAG_BLACK;
-
+
/* put node in new list */
BLI_remlink(&pose->chanbase, node->ob);
BLI_addhead(&tempbase, node->ob);
}
}
}
-
+
/* temporal correction for circular dependencies */
while (pose->chanbase.first) {
pchan = pose->chanbase.first;
@@ -3272,15 +3272,15 @@ void DAG_pose_sort(Object *ob)
printf("cyclic %s\n", pchan->name);
}
-
+
pose->chanbase = tempbase;
queue_delete(nqueue);
-
+
// printf("\nordered\n");
// for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
// printf(" %s\n", pchan->name);
// }
-
+
free_forest(dag);
MEM_freeN(dag);
}
@@ -3380,7 +3380,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob)
printf("\nDEPENDENCY RELATIONS for %s\n\n", scene->id.name + 2);
DAG_scene_relations_rebuild(bmain, scene);
}
-
+
dag_print_dependencies = 0;
}
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index ffa7fdc3ec9..fa4e4372273 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1093,7 +1093,7 @@ static void emDM_drawMappedFaces(
efa = ltri[0]->f;
drawSmooth = lnors || ((flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH));
-
+
draw_option = (setDrawOptions ?
setDrawOptions(userData, BM_elem_index_get(efa)) :
DM_DRAW_OPTION_NORMAL);
@@ -1120,7 +1120,7 @@ static void emDM_drawMappedFaces(
}
prev_mat_nr = efa->mat_nr;
}
-
+
if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
if (poly_prev != GL_ZERO) glEnd();
diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c
index 2927354241c..c1121d5b1ea 100644
--- a/source/blender/blenkernel/intern/editmesh_bvh.c
+++ b/source/blender/blenkernel/intern/editmesh_bvh.c
@@ -147,9 +147,9 @@ BMBVHTree *BKE_bmbvh_new_ex(
BLI_bvhtree_insert(bmtree->tree, i, (float *)cos, 3);
}
-
+
BLI_bvhtree_balance(bmtree->tree);
-
+
return bmtree;
}
@@ -188,11 +188,11 @@ BMBVHTree *BKE_bmbvh_new(
void BKE_bmbvh_free(BMBVHTree *bmtree)
{
BLI_bvhtree_free(bmtree->tree);
-
+
if (bmtree->cos_cage && bmtree->cos_cage_free) {
MEM_freeN((void *)bmtree->cos_cage);
}
-
+
MEM_freeN(bmtree);
}
@@ -313,7 +313,7 @@ BMFace *BKE_bmbvh_ray_cast(BMBVHTree *bmtree, const float co[3], const float dir
/* ok to leave 'uv' uninitialized */
bmcb_data.looptris = (const BMLoop *(*)[3])bmtree->looptris;
bmcb_data.cos_cage = (const float (*)[3])bmtree->cos_cage;
-
+
BLI_bvhtree_ray_cast(bmtree->tree, co, dir, radius, &hit, bmbvh_ray_cast_cb, &bmcb_data);
if (hit.index != -1 && hit.dist != dist) {
@@ -547,4 +547,4 @@ BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a, const BMBVHTree *bm
data.epsilon = max_ff(BLI_bvhtree_get_epsilon(bmtree_a->tree), BLI_bvhtree_get_epsilon(bmtree_b->tree));
return BLI_bvhtree_overlap(bmtree_a->tree, bmtree_b->tree, r_overlap_tot, bmbvh_overlap_cb, &data);
-} \ No newline at end of file
+}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index e47af83e00e..89f85530439 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -212,10 +212,10 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
Base *base;
unsigned int layer= ob_src->lay;
ListBase *effectors = NULL;
-
+
if (weights->group) {
GroupObject *go;
-
+
for (go= weights->group->gobject.first; go; go= go->next) {
if ( (go->ob->lay & layer) ) {
if ( go->ob->pd && go->ob->pd->forcefield )
@@ -245,10 +245,10 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
}
}
}
-
+
if (for_simulation)
pdPrecalculateEffectors(effectors);
-
+
return effectors;
}
@@ -326,7 +326,7 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
point->index = pa - sim->psys->particles;
point->size = pa->size;
point->charge = 0.0f;
-
+
if (part->pd && part->pd->forcefield == PFIELD_CHARGE)
point->charge += part->pd->f_strength;
@@ -385,7 +385,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte
// triangle - ray callback function
static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
-{
+{
/* whenever we hit a bounding box, we don't check further */
hit->dist = -1;
hit->index = 1;
@@ -399,7 +399,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
ColliderCache *col;
float norm[3], len = 0.0;
float visibility = 1.0, absorption = 0.0;
-
+
if (!(eff->pd->flag & PFIELD_VISIBILITY))
return visibility;
@@ -411,7 +411,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
negate_v3_v3(norm, efd->vec_to_point);
len = normalize_v3(norm);
-
+
/* check all collision objects */
for (col = colls->first; col; col = col->next) {
CollisionModifierData *collmd = col->collmd;
@@ -434,7 +434,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
/* visibility is only between 0 and 1, calculated from 1-absorption */
visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
-
+
if (visibility <= 0.0f)
break;
}
@@ -443,7 +443,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
if (!colliders)
free_collider_cache(&colls);
-
+
return visibility;
}
@@ -454,11 +454,11 @@ static float wind_func(struct RNG *rng, float strength)
float force = BLI_rng_get_float(rng) + 1.0f;
float ret;
float sign = 0;
-
+
sign = ((float)random > 64.0f) ? 1.0f: -1.0f; // dividing by 2 is not giving equal sign distribution
-
+
ret = sign*((float)random / force)*strength/128.0f;
-
+
return ret;
}
@@ -551,7 +551,7 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
if (surface_vel) {
const MLoop *mloop = surmd->bvhtree->loop;
const MLoopTri *lt = &surmd->bvhtree->looptri[nearest.index];
-
+
copy_v3_v3(surface_vel, surmd->v[mloop[lt->tri[0]].v].co);
add_v3_v3(surface_vel, surmd->v[mloop[lt->tri[1]].v].co);
add_v3_v3(surface_vel, surmd->v[mloop[lt->tri[2]].v].co);
@@ -632,7 +632,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->nor[0] = 1.f;
efd->nor[1] = efd->nor[2] = 0.f;
mul_qt_v3(state.rot, efd->nor);
-
+
if (real_velocity)
copy_v3_v3(efd->vel, state.vel);
@@ -705,9 +705,9 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
}
else if (eff->psys) {
*tot = eff->psys->totpart;
-
+
if (eff->pd->forcefield == PFIELD_CHARGE) {
- /* Only the charge of the effected particle is used for
+ /* Only the charge of the effected particle is used for
* interaction, not fall-offs. If the fall-offs aren't the
* same this will be unphysical, but for animation this
* could be the wanted behavior. If you want physical
@@ -869,10 +869,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
/* new vortex force */
cross_v3_v3v3(temp, efd->nor2, efd->vec_to_point2);
mul_v3_fl(temp, strength * efd->falloff);
-
+
cross_v3_v3v3(force, efd->nor2, temp);
mul_v3_fl(force, strength * efd->falloff);
-
+
madd_v3_v3fl(temp, point->vel, -point->vel_to_sec);
add_v3_v3(force, temp);
}
@@ -900,7 +900,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
case PFIELD_LENNARDJ:
fac = pow((efd->size + point->size) / efd->distance, 6.0);
-
+
fac = - fac * (1.0f - fac) / efd->distance;
/* limit the repulsive term drastically to avoid huge forces */
@@ -1005,7 +1005,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
/* Check for min distance here? (yes would be cool to add that, ton) */
-
+
if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
/* object effectors were fully checked to be OK to evaluate! */
@@ -1014,7 +1014,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
for (; p<tot; p+=step) {
if (get_effector_data(eff, &efd, point, 0)) {
efd.falloff= effector_falloff(eff, &efd, point, weights);
-
+
if (efd.falloff > 0.0f)
efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
@@ -1029,7 +1029,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
copy_v3_v3(temp1, force);
do_physical_effector(eff, &efd, point, force);
-
+
/* for softbody backward compatibility */
if (point->flag & PE_WIND_AS_SPEED && impulse) {
sub_v3_v3v3(temp2, force, temp1);
@@ -1142,14 +1142,14 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[
{
unsigned int category_hash = BLI_ghashutil_strhash_p(category);
SimDebugElement *elem;
-
+
if (!_sim_debug_data) {
if (G.debug & G_DEBUG_SIMDATA)
BKE_sim_debug_data_set_enabled(true);
else
return;
}
-
+
elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
elem->type = type;
elem->category_hash = category_hash;
@@ -1169,7 +1169,7 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[
BLI_strncpy(elem->str, str, sizeof(elem->str));
else
elem->str[0] = '\0';
-
+
debug_data_insert(_sim_debug_data, elem);
}
@@ -1178,7 +1178,7 @@ void BKE_sim_debug_data_remove_element(unsigned int hash)
SimDebugElement dummy;
if (!_sim_debug_data)
return;
-
+
dummy.hash = hash;
BLI_ghash_remove(_sim_debug_data->gh, &dummy, NULL, debug_element_free);
}
@@ -1187,7 +1187,7 @@ void BKE_sim_debug_data_clear(void)
{
if (!_sim_debug_data)
return;
-
+
if (_sim_debug_data->gh)
BLI_ghash_clear(_sim_debug_data->gh, NULL, debug_element_free);
}
@@ -1195,17 +1195,17 @@ void BKE_sim_debug_data_clear(void)
void BKE_sim_debug_data_clear_category(const char *category)
{
int category_hash = (int)BLI_ghashutil_strhash_p(category);
-
+
if (!_sim_debug_data)
return;
-
+
if (_sim_debug_data->gh) {
GHashIterator iter;
BLI_ghashIterator_init(&iter, _sim_debug_data->gh);
while (!BLI_ghashIterator_done(&iter)) {
const SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
BLI_ghashIterator_step(&iter); /* removing invalidates the current iterator, so step before removing */
-
+
if (elem->category_hash == category_hash)
BLI_ghash_remove(_sim_debug_data->gh, elem, NULL, debug_element_free);
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 0de04e31be9..524919b3dc0 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -29,7 +29,7 @@
* \ingroup bke
*/
-
+
#include <math.h>
#include <stdio.h>
@@ -58,7 +58,7 @@
#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
-#include "BKE_curve.h"
+#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_nla.h"
@@ -66,7 +66,7 @@
#include "RNA_access.h"
#ifdef WITH_PYTHON
-#include "BPY_extern.h"
+#include "BPY_extern.h"
#endif
#define SMALL -1.0e-10
@@ -83,20 +83,20 @@ static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER;
/* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */
void free_fcurve(FCurve *fcu)
{
- if (fcu == NULL)
+ if (fcu == NULL)
return;
/* free curve data */
MEM_SAFE_FREE(fcu->bezt);
MEM_SAFE_FREE(fcu->fpt);
-
+
/* free RNA-path, as this were allocated when getting the path string */
MEM_SAFE_FREE(fcu->rna_path);
-
+
/* free extra data - i.e. modifiers, and driver */
fcurve_free_driver(fcu);
free_fmodifiers(&fcu->modifiers);
-
+
/* free f-curve itself */
MEM_freeN(fcu);
}
@@ -105,12 +105,12 @@ void free_fcurve(FCurve *fcu)
void free_fcurves(ListBase *list)
{
FCurve *fcu, *fcn;
-
+
/* sanity check */
if (list == NULL)
return;
-
- /* free data - no need to call remlink before freeing each curve,
+
+ /* free data - no need to call remlink before freeing each curve,
* as we store reference to next, and freeing only touches the curve
* it's given
*/
@@ -118,10 +118,10 @@ void free_fcurves(ListBase *list)
fcn = fcu->next;
free_fcurve(fcu);
}
-
+
/* clear pointers just in case */
BLI_listbase_clear(list);
-}
+}
/* ---------------------- Copy --------------------------- */
@@ -129,30 +129,30 @@ void free_fcurves(ListBase *list)
FCurve *copy_fcurve(const FCurve *fcu)
{
FCurve *fcu_d;
-
+
/* sanity check */
if (fcu == NULL)
return NULL;
-
+
/* make a copy */
fcu_d = MEM_dupallocN(fcu);
-
+
fcu_d->next = fcu_d->prev = NULL;
fcu_d->grp = NULL;
-
+
/* copy curve data */
fcu_d->bezt = MEM_dupallocN(fcu_d->bezt);
fcu_d->fpt = MEM_dupallocN(fcu_d->fpt);
-
+
/* copy rna-path */
fcu_d->rna_path = MEM_dupallocN(fcu_d->rna_path);
-
+
/* copy driver */
fcu_d->driver = fcurve_copy_driver(fcu_d->driver);
-
+
/* copy modifiers */
copy_fmodifiers(&fcu_d->modifiers, &fcu->modifiers);
-
+
/* return new data */
return fcu_d;
}
@@ -161,14 +161,14 @@ FCurve *copy_fcurve(const FCurve *fcu)
void copy_fcurves(ListBase *dst, ListBase *src)
{
FCurve *dfcu, *sfcu;
-
+
/* sanity checks */
if (ELEM(NULL, dst, src))
return;
-
+
/* clear destination list first */
BLI_listbase_clear(dst);
-
+
/* copy one-by-one */
for (sfcu = src->first; sfcu; sfcu = sfcu->next) {
dfcu = copy_fcurve(sfcu);
@@ -192,22 +192,22 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
if (r_driven)
*r_driven = false;
-
+
/* only use the current action ??? */
if (ELEM(NULL, adt, adt->action))
return NULL;
-
+
RNA_pointer_create(id, type, data, &ptr);
prop = RNA_struct_find_property(&ptr, prop_name);
-
+
if (prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
-
+
if (path) {
/* animation takes priority over drivers */
if ((adt->action) && (adt->action->curves.first))
fcu = list_find_fcurve(&adt->action->curves, path, index);
-
+
/* if not animated, check if driven */
if ((fcu == NULL) && (adt->drivers.first)) {
fcu = list_find_fcurve(&adt->drivers, path, index);
@@ -215,7 +215,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
*r_driven = true;
fcu = NULL;
}
-
+
MEM_freeN(path);
}
}
@@ -228,11 +228,11 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index)
{
FCurve *fcu;
-
+
/* sanity checks */
if (ELEM(NULL, list, rna_path) || (array_index < 0) )
return NULL;
-
+
/* check paths of curves, then array indices... */
for (fcu = list->first; fcu; fcu = fcu->next) {
/* simple string-compare (this assumes that they have the same root...) */
@@ -242,7 +242,7 @@ FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_
return fcu;
}
}
-
+
/* return */
return NULL;
}
@@ -251,7 +251,7 @@ FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_
FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
{
FCurve *fcu;
-
+
/* sanity checks */
if (ELEM(NULL, fcu_iter, rna_path))
return NULL;
@@ -268,7 +268,7 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
return NULL;
}
-/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
+/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
* Lists...
* - dst: list of LinkData's matching the criteria returned.
* List must be freed after use, and is assumed to be empty when passed.
@@ -281,36 +281,36 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
{
FCurve *fcu;
int matches = 0;
-
+
/* sanity checks */
if (ELEM(NULL, dst, src, dataPrefix, dataName))
return 0;
else if ((dataPrefix[0] == 0) || (dataName[0] == 0))
return 0;
-
+
/* search each F-Curve one by one */
for (fcu = src->first; fcu; fcu = fcu->next) {
/* check if quoted string matches the path */
if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
-
+
if (quotedName) {
/* check if the quoted name matches the required name */
if (STREQ(quotedName, dataName)) {
LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
-
+
ld->data = fcu;
BLI_addtail(dst, ld);
-
+
matches++;
}
-
+
/* always free the quoted string, since it needs freeing */
MEM_freeN(quotedName);
}
}
}
-
+
/* return the number of matches */
return matches;
}
@@ -328,39 +328,39 @@ FCurve *rna_get_fcurve_context_ui(
{
FCurve *fcu = NULL;
PointerRNA tptr = *ptr;
-
+
*r_driven = false;
*r_special = false;
-
+
if (r_animdata) *r_animdata = NULL;
if (r_action) *r_action = NULL;
-
+
/* Special case for NLA Control Curves... */
if (BKE_nlastrip_has_curves_for_property(ptr, prop)) {
NlaStrip *strip = (NlaStrip *)ptr->data;
-
+
/* Set the special flag, since it cannot be a normal action/driver
* if we've been told to start looking here...
*/
*r_special = true;
-
+
/* The F-Curve either exists or it doesn't here... */
fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), rnaindex);
return fcu;
}
-
+
/* there must be some RNA-pointer + property combon */
if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) {
AnimData *adt = BKE_animdata_from_id(tptr.id.data);
int step = C ? 2 : 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */
char *path = NULL;
-
+
if (!adt && C) {
path = BKE_animdata_driver_path_hack(C, &tptr, prop, NULL);
adt = BKE_animdata_from_id(tptr.id.data);
step--;
}
-
+
/* Standard F-Curve - Animation (Action) or Drivers */
while (adt && step--) {
if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
@@ -368,27 +368,27 @@ FCurve *rna_get_fcurve_context_ui(
if (step) {
path = RNA_path_from_ID_to_property(&tptr, prop);
}
-
+
// XXX: the logic here is duplicated with a function up above
if (path) {
/* animation takes priority over drivers */
if (adt->action && adt->action->curves.first) {
fcu = list_find_fcurve(&adt->action->curves, path, rnaindex);
-
+
if (fcu && r_action)
*r_action = adt->action;
}
-
+
/* if not animated, check if driven */
if (!fcu && (adt->drivers.first)) {
fcu = list_find_fcurve(&adt->drivers, path, rnaindex);
-
+
if (fcu) {
if (r_animdata) *r_animdata = adt;
*r_driven = true;
}
}
-
+
if (fcu && r_action) {
if (r_animdata) *r_animdata = adt;
*r_action = adt->action;
@@ -410,7 +410,7 @@ FCurve *rna_get_fcurve_context_ui(
}
MEM_SAFE_FREE(path);
}
-
+
return fcu;
}
@@ -423,10 +423,10 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
{
int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2;
-
+
/* initialize replace-flag first */
*r_replace = false;
-
+
/* sneaky optimizations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds
* - keyframe to be added would replace one of the existing ones on bounds
@@ -438,7 +438,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
else {
/* check whether to add before/after/on */
float framenum;
-
+
/* 'First' Keyframe (when only one keyframe, this case is used) */
framenum = array[0].vec[1][0];
if (IS_EQT(frame, framenum, threshold)) {
@@ -447,7 +447,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
}
else if (frame < framenum)
return 0;
-
+
/* 'Last' Keyframe */
framenum = array[(arraylen - 1)].vec[1][0];
if (IS_EQT(frame, framenum, threshold)) {
@@ -457,37 +457,37 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
else if (frame > framenum)
return arraylen;
}
-
-
+
+
/* most of the time, this loop is just to find where to put it
- * 'loopbreaker' is just here to prevent infinite loops
+ * 'loopbreaker' is just here to prevent infinite loops
*/
for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
/* compute and get midpoint */
int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
float midfra = array[mid].vec[1][0];
-
+
/* check if exactly equal to midpoint */
if (IS_EQT(frame, midfra, threshold)) {
*r_replace = true;
return mid;
}
-
+
/* repeat in upper/lower half */
if (frame > midfra)
start = mid + 1;
else if (frame < midfra)
end = mid - 1;
}
-
+
/* print error if loop-limit exceeded */
if (loopbreaker == (maxloop - 1)) {
printf("Error: binarysearch_bezt_index() was taking too long\n");
-
+
/* include debug info */
printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
}
-
+
/* not found, so return where to place it */
return start;
}
@@ -509,20 +509,20 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
const bool do_sel_only)
{
bool found = false;
-
+
/* init outputs */
*first = NULL;
*last = NULL;
-
+
/* sanity checks */
if (fcu->bezt == NULL)
return found;
-
+
/* only include selected items? */
if (do_sel_only) {
BezTriple *bezt;
unsigned int i;
-
+
/* find first selected */
bezt = fcu->bezt;
for (i = 0; i < fcu->totvert; bezt++, i++) {
@@ -532,7 +532,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
break;
}
}
-
+
/* find last selected */
bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert);
for (i = 0; i < fcu->totvert; bezt--, i++) {
@@ -549,7 +549,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
*last = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert);
found = true;
}
-
+
return found;
}
@@ -562,18 +562,18 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
float yminv = 999999999.0f, ymaxv = -999999999.0f;
bool foundvert = false;
unsigned int i;
-
+
if (fcu->totvert) {
if (fcu->bezt) {
BezTriple *bezt_first = NULL, *bezt_last = NULL;
-
+
if (xmin || xmax) {
/* get endpoint keyframes */
foundvert = get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
-
+
if (bezt_first) {
BLI_assert(bezt_last != NULL);
-
+
if (include_handles) {
xminv = min_fff(xminv, bezt_first->vec[0][0], bezt_first->vec[1][0]);
xmaxv = max_fff(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]);
@@ -584,33 +584,33 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
}
}
}
-
+
/* only loop over keyframes to find extents for values if needed */
if (ymin || ymax) {
BezTriple *bezt, *prevbezt = NULL;
-
+
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; prevbezt = bezt, bezt++, i++) {
if ((do_sel_only == false) || BEZT_ISSEL_ANY(bezt)) {
/* keyframe itself */
yminv = min_ff(yminv, bezt->vec[1][1]);
ymaxv = max_ff(ymaxv, bezt->vec[1][1]);
-
+
if (include_handles) {
- /* left handle - only if applicable
+ /* left handle - only if applicable
* NOTE: for the very first keyframe, the left handle actually has no bearings on anything
*/
if (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) {
yminv = min_ff(yminv, bezt->vec[0][1]);
ymaxv = max_ff(ymaxv, bezt->vec[0][1]);
}
-
+
/* right handle - only if applicable */
if (bezt->ipo == BEZT_IPO_BEZ) {
yminv = min_ff(yminv, bezt->vec[2][1]);
ymaxv = max_ff(ymaxv, bezt->vec[2][1]);
}
}
-
+
foundvert = true;
}
}
@@ -622,41 +622,41 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
xminv = min_ff(xminv, fcu->fpt[0].vec[0]);
xmaxv = max_ff(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
}
-
+
/* only loop over keyframes to find extents for values if needed */
if (ymin || ymax) {
FPoint *fpt;
-
+
for (fpt = fcu->fpt, i = 0; i < fcu->totvert; fpt++, i++) {
if (fpt->vec[1] < yminv)
yminv = fpt->vec[1];
if (fpt->vec[1] > ymaxv)
ymaxv = fpt->vec[1];
-
+
foundvert = true;
}
}
}
}
-
+
if (foundvert) {
if (xmin) *xmin = xminv;
if (xmax) *xmax = xmaxv;
-
+
if (ymin) *ymin = yminv;
if (ymax) *ymax = ymaxv;
}
else {
if (G.debug & G_DEBUG)
printf("F-Curve calc bounds didn't find anything, so assuming minimum bounds of 1.0\n");
-
+
if (xmin) *xmin = 0.0f;
if (xmax) *xmax = 1.0f;
-
+
if (ymin) *ymin = 0.0f;
if (ymax) *ymax = 1.0f;
}
-
+
return foundvert;
}
@@ -670,28 +670,28 @@ bool calc_fcurve_range(FCurve *fcu, float *start, float *end,
if (fcu->totvert) {
if (fcu->bezt) {
BezTriple *bezt_first = NULL, *bezt_last = NULL;
-
+
/* get endpoint keyframes */
get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
-
+
if (bezt_first) {
BLI_assert(bezt_last != NULL);
-
+
min = min_ff(min, bezt_first->vec[1][0]);
max = max_ff(max, bezt_last->vec[1][0]);
-
+
foundvert = true;
}
}
else if (fcu->fpt) {
min = min_ff(min, fcu->fpt[0].vec[0]);
max = max_ff(max, fcu->fpt[fcu->totvert - 1].vec[0]);
-
+
foundvert = true;
}
-
+
}
-
+
if (foundvert == false) {
min = max = 0.0f;
}
@@ -711,7 +711,7 @@ bool calc_fcurve_range(FCurve *fcu, float *start, float *end,
/* ----------------- Status Checks -------------------------- */
-/* Are keyframes on F-Curve of any use?
+/* Are keyframes on F-Curve of any use?
* Usability of keyframes refers to whether they should be displayed,
* and also whether they will have any influence on the final result.
*/
@@ -720,11 +720,11 @@ bool fcurve_are_keyframes_usable(FCurve *fcu)
/* F-Curve must exist */
if (fcu == NULL)
return false;
-
+
/* F-Curve must not have samples - samples are mutually exclusive of keyframes */
if (fcu->fpt)
return false;
-
+
/* if it has modifiers, none of these should "drastically" alter the curve */
if (fcu->modifiers.first) {
FModifier *fcm;
@@ -735,7 +735,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu)
/* ignore if muted/disabled */
if (fcm->flag & (FMODIFIER_FLAG_DISABLED | FMODIFIER_FLAG_MUTED))
continue;
-
+
/* type checks */
switch (fcm->type) {
/* clearly harmless - do nothing */
@@ -743,12 +743,12 @@ bool fcurve_are_keyframes_usable(FCurve *fcu)
case FMODIFIER_TYPE_STEPPED:
case FMODIFIER_TYPE_NOISE:
break;
-
+
/* sometimes harmful - depending on whether they're "additive" or not */
case FMODIFIER_TYPE_GENERATOR:
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
-
+
if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0)
return false;
break;
@@ -756,7 +756,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu)
case FMODIFIER_TYPE_FN_GENERATOR:
{
FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data;
-
+
if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0)
return false;
break;
@@ -767,7 +767,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu)
}
}
}
-
+
/* keyframes are usable */
return true;
}
@@ -778,7 +778,7 @@ bool BKE_fcurve_is_protected(FCurve *fcu)
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)));
}
-/* Can keyframes be added to F-Curve?
+/* Can keyframes be added to F-Curve?
* Keyframes can only be added if they are already visible
*/
bool fcurve_is_keyframable(FCurve *fcu)
@@ -786,11 +786,11 @@ bool fcurve_is_keyframable(FCurve *fcu)
/* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on final result) */
if (fcurve_are_keyframes_usable(fcu) == 0)
return false;
-
+
/* F-Curve must currently be editable too */
if (BKE_fcurve_is_protected(fcu))
return false;
-
+
/* F-Curve is keyframable */
return true;
}
@@ -801,7 +801,7 @@ bool fcurve_is_keyframable(FCurve *fcu)
void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
{
CfraElem *ce, *cen;
-
+
for (ce = lb->first; ce; ce = ce->next) {
/* double key? */
if (IS_EQT(ce->cfra, bezt->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
@@ -811,7 +811,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
/* should key be inserted before this column? */
else if (ce->cfra > bezt->vec[1][0]) break;
}
-
+
/* create a new column */
cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
if (ce) BLI_insertlinkbefore(lb, ce, cen);
@@ -826,26 +826,26 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
* data imported from BVH/Mocap files), which are specialized for use with high density datasets,
* which BezTriples/Keyframe data are ill equipped to do.
*/
-
-
-/* Basic sampling callback which acts as a wrapper for evaluate_fcurve()
+
+
+/* Basic sampling callback which acts as a wrapper for evaluate_fcurve()
* 'data' arg here is unneeded here...
*/
float fcurve_samplingcb_evalcurve(FCurve *fcu, void *UNUSED(data), float evaltime)
{
/* assume any interference from drivers on the curve is intended... */
return evaluate_fcurve(fcu, evaltime);
-}
+}
-
-/* Main API function for creating a set of sampled curve data, given some callback function
+
+/* Main API function for creating a set of sampled curve data, given some callback function
* used to retrieve the values to store.
*/
void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb)
{
FPoint *fpt, *new_fpt;
int cfra;
-
+
/* sanity checks */
/* TODO: make these tests report errors using reports not printf's */
if (ELEM(NULL, fcu, sample_cb)) {
@@ -856,20 +856,20 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample
printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n");
return;
}
-
+
/* set up sample data */
fpt = new_fpt = MEM_callocN(sizeof(FPoint) * (end - start + 1), "FPoint Samples");
-
+
/* use the sampling callback at 1-frame intervals from start to end frames */
for (cfra = start; cfra <= end; cfra++, fpt++) {
fpt->vec[0] = (float)cfra;
fpt->vec[1] = sample_cb(fcu, data, (float)cfra);
}
-
+
/* free any existing sample/keyframe data on curve */
if (fcu->bezt) MEM_freeN(fcu->bezt);
if (fcu->fpt) MEM_freeN(fcu->fpt);
-
+
/* store the samples */
fcu->bezt = NULL;
fcu->fpt = new_fpt;
@@ -922,7 +922,7 @@ static BezTriple *cycle_offset_triple(bool cycle, BezTriple *out, const BezTripl
return out;
}
-/* This function recalculates the handles of an F-Curve
+/* This function recalculates the handles of an F-Curve
* If the BezTriples have been rearranged, sort them first before using this.
*/
void calchandles_fcurve(FCurve *fcu)
@@ -935,7 +935,7 @@ void calchandles_fcurve(FCurve *fcu)
* - need bezier keys
* - only bezier-interpolation has handles (for now)
*/
- if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/)
+ if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/)
return;
/* if the first modifier is Cycles, smooth the curve through the cycle */
@@ -948,16 +948,16 @@ void calchandles_fcurve(FCurve *fcu)
bezt = fcu->bezt;
prev = cycle_offset_triple(cycle, &tmp, &fcu->bezt[fcu->totvert - 2], last, first);
next = (bezt + 1);
-
+
/* loop over all beztriples, adjusting handles */
while (a--) {
/* clamp timing of handles to be on either side of beztriple */
if (bezt->vec[0][0] > bezt->vec[1][0]) bezt->vec[0][0] = bezt->vec[1][0];
if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0] = bezt->vec[1][0];
-
+
/* calculate auto-handles */
BKE_nurb_handle_calc(bezt, prev, next, true, fcu->auto_smoothing);
-
+
/* for automatic ease in and out */
if (BEZT_IS_AUTOH(bezt) && !cycle) {
/* only do this on first or last beztriple */
@@ -975,7 +975,7 @@ void calchandles_fcurve(FCurve *fcu)
if (prev && prev->vec[1][0] >= bezt->vec[1][0]) {
prev->f5 = bezt->f5 = HD_AUTOTYPE_SPECIAL;
}
-
+
/* advance pointers for next iteration */
prev = bezt;
@@ -1026,16 +1026,16 @@ void testhandles_fcurve(FCurve *fcu, const bool use_handle)
void sort_time_fcurve(FCurve *fcu)
{
bool ok = true;
-
+
/* keep adjusting order of beztriples until nothing moves (bubble-sort) */
while (ok) {
ok = 0;
-
+
/* currently, will only be needed when there are beztriples */
if (fcu->bezt) {
BezTriple *bezt;
unsigned int a;
-
+
/* loop over ALL points to adjust position in array and recalculate handles */
for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) {
/* check if thee's a next beztriple which we could try to swap with current */
@@ -1045,7 +1045,7 @@ void sort_time_fcurve(FCurve *fcu)
SWAP(BezTriple, *bezt, *(bezt + 1));
ok = 1;
}
-
+
/* if either one of both of the points exceeds crosses over the keyframe time... */
if ( (bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0]) ) {
/* swap handles if they have switched sides for some reason */
@@ -1066,15 +1066,15 @@ void sort_time_fcurve(FCurve *fcu)
short test_time_fcurve(FCurve *fcu)
{
unsigned int a;
-
+
/* sanity checks */
if (fcu == NULL)
return 0;
-
+
/* currently, only need to test beztriples */
if (fcu->bezt) {
BezTriple *bezt;
-
+
/* loop through all BezTriples, stopping when one exceeds the one after it */
for (a = 0, bezt = fcu->bezt; a < (fcu->totvert - 1); a++, bezt++) {
if (bezt->vec[1][0] > (bezt + 1)->vec[1][0])
@@ -1083,14 +1083,14 @@ short test_time_fcurve(FCurve *fcu)
}
else if (fcu->fpt) {
FPoint *fpt;
-
+
/* loop through all FPoints, stopping when one exceeds the one after it */
for (a = 0, fpt = fcu->fpt; a < (fcu->totvert - 1); a++, fpt++) {
if (fpt->vec[0] > (fpt + 1)->vec[0])
return 1;
}
}
-
+
/* none need any swapping */
return 0;
}
@@ -1103,7 +1103,7 @@ short test_time_fcurve(FCurve *fcu)
typedef struct DriverVarTypeInfo {
/* evaluation callback */
float (*get_value)(ChannelDriver *driver, DriverVar *dvar);
-
+
/* allocation of target slots */
int num_targets; /* number of target slots required */
const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */
@@ -1113,7 +1113,7 @@ typedef struct DriverVarTypeInfo {
/* Macro to begin definitions */
#define BEGIN_DVAR_TYPEDEF(type) \
{
-
+
/* Macro to end definitions */
#define END_DVAR_TYPEDEF \
}
@@ -1135,27 +1135,27 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
ID *id;
int index = -1;
float value = 0.0f;
-
+
/* sanity check */
if (ELEM(NULL, driver, dtar))
return 0.0f;
-
+
id = dtar_id_ensure_proxy_from(dtar->id);
-
+
/* error check for missing pointer... */
if (id == NULL) {
if (G.debug & G_DEBUG) {
printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
}
-
+
driver->flag |= DRIVER_FLAG_INVALID;
dtar->flag |= DTAR_FLAG_INVALID;
return 0.0f;
}
-
+
/* get RNA-pointer for the ID-block given in target */
RNA_id_pointer_create(id, &id_ptr);
-
+
/* get property to read from, and get value as appropriate */
if (RNA_path_resolve_property_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
if (RNA_property_array_check(prop)) {
@@ -1178,10 +1178,10 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
else {
/* out of bounds */
if (G.debug & G_DEBUG) {
- printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
+ printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
id->name, dtar->rna_path, index);
}
-
+
driver->flag |= DRIVER_FLAG_INVALID;
dtar->flag |= DTAR_FLAG_INVALID;
return 0.0f;
@@ -1212,12 +1212,12 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
if (G.debug & G_DEBUG) {
printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
}
-
+
driver->flag |= DRIVER_FLAG_INVALID;
dtar->flag |= DTAR_FLAG_INVALID;
return 0.0f;
}
-
+
/* if we're still here, we should be ok... */
dtar->flag &= ~DTAR_FLAG_INVALID;
return value;
@@ -1302,7 +1302,7 @@ static bPoseChannel *dtar_get_pchan_ptr(ChannelDriver *driver, DriverTarget *dta
/* check if the ID here is a valid object */
if (id && GS(id->name)) {
Object *ob = (Object *)id;
-
+
/* get pose, and subsequently, posechannel */
return BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
}
@@ -1426,24 +1426,24 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id);
bPoseChannel *pchan;
float tmp_loc[3];
-
+
/* after the checks above, the targets should be valid here... */
BLI_assert((ob != NULL) && (GS(ob->id.name) == ID_OB));
-
+
/* try to get posechannel */
pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
-
+
/* check if object or bone */
if (pchan) {
/* bone */
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
float mat[4][4];
-
+
/* extract transform just like how the constraints do it! */
copy_m4_m4(mat, pchan->pose_mat);
BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL, false);
-
+
/* ... and from that, we get our transform */
copy_v3_v3(tmp_loc, mat[3]);
}
@@ -1464,11 +1464,11 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
/* XXX: this should practically be the same as transform space... */
float mat[4][4];
-
+
/* extract transform just like how the constraints do it! */
copy_m4_m4(mat, ob->obmat);
BKE_constraint_mat_convertspace(ob, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false);
-
+
/* ... and from that, we get our transform */
copy_v3_v3(tmp_loc, mat[3]);
}
@@ -1482,7 +1482,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
copy_v3_v3(tmp_loc, ob->obmat[3]);
}
}
-
+
/* copy the location to the right place */
if (tarIndex) {
copy_v3_v3(loc2, tmp_loc);
@@ -1492,10 +1492,10 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
}
}
DRIVER_TARGETS_LOOPER_END
-
-
+
+
/* if we're still here, there should now be two targets to use,
- * so just take the length of the vector between these points
+ * so just take the length of the vector between these points
*/
return len_v3v3(loc1, loc2);
}
@@ -1510,7 +1510,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
float oldEul[3] = {0.0f, 0.0f, 0.0f};
bool use_eulers = false;
short rot_order = ROT_MODE_EUL;
-
+
/* check if this target has valid data */
if ((ob == NULL) || (GS(ob->id.name) != ID_OB)) {
/* invalid target, so will not have enough targets */
@@ -1522,11 +1522,11 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
/* target should be valid now */
dtar->flag &= ~DTAR_FLAG_INVALID;
}
-
+
/* try to get posechannel */
pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
-
- /* check if object or bone, and get transform matrix accordingly
+
+ /* check if object or bone, and get transform matrix accordingly
* - "useEulers" code is used to prevent the problems associated with non-uniqueness
* of euler decomposition from matrices [#20870]
* - localspace is for [#21384], where parent results are not wanted
@@ -1539,7 +1539,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
rot_order = pchan->rotmode;
use_eulers = true;
}
-
+
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
/* just like how the constraints do it! */
@@ -1547,7 +1547,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL, false);
}
else {
- /* specially calculate local matrix, since chan_mat is not valid
+ /* specially calculate local matrix, since chan_mat is not valid
* since it stores delta transform of pose_mat so that deforms work
* so it cannot be used here for "transform" space
*/
@@ -1566,7 +1566,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
rot_order = ob->rotmode;
use_eulers = true;
}
-
+
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
/* just like how the constraints do it! */
@@ -1583,7 +1583,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
copy_m4_m4(mat, ob->obmat);
}
}
-
+
/* check which transform */
if (dtar->transChan >= MAX_DTAR_TRANSCHAN_TYPES) {
/* not valid channel */
@@ -1595,22 +1595,22 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
return len_v3(mat[dtar->transChan - DTAR_TRANSCHAN_SCALEX]);
}
else if (dtar->transChan >= DTAR_TRANSCHAN_ROTX) {
- /* extract rotation as eulers (if needed)
+ /* extract rotation as eulers (if needed)
* - definitely if rotation order isn't eulers already
* - if eulers, then we have 2 options:
* a) decompose transform matrix as required, then try to make eulers from
* there compatible with original values
- * b) [NOT USED] directly use the original values (no decomposition)
+ * b) [NOT USED] directly use the original values (no decomposition)
* - only an option for "transform space", if quality is really bad with a)
*/
float eul[3];
-
+
mat4_to_eulO(eul, rot_order, mat);
-
+
if (use_eulers) {
compatible_eul(eul, oldEul);
}
-
+
return eul[dtar->transChan - DTAR_TRANSCHAN_ROTX];
}
else {
@@ -1629,21 +1629,21 @@ static DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = {
{"Property"}, /* UI names for targets */
{0} /* flags */
END_DVAR_TYPEDEF,
-
+
BEGIN_DVAR_TYPEDEF(DVAR_TYPE_ROT_DIFF)
dvar_eval_rotDiff, /* eval callback */
2, /* number of targets used */
{"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */
{DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */
END_DVAR_TYPEDEF,
-
+
BEGIN_DVAR_TYPEDEF(DVAR_TYPE_LOC_DIFF)
dvar_eval_locDiff, /* eval callback */
2, /* number of targets used */
{"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */
{DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */
END_DVAR_TYPEDEF,
-
+
BEGIN_DVAR_TYPEDEF(DVAR_TYPE_TRANSFORM_CHAN)
dvar_eval_transChan, /* eval callback */
1, /* number of targets used */
@@ -1670,20 +1670,20 @@ void driver_free_variable(ListBase *variables, DriverVar *dvar)
/* sanity checks */
if (dvar == NULL)
return;
-
- /* free target vars
+
+ /* free target vars
* - need to go over all of them, not just up to the ones that are used
- * currently, since there may be some lingering RNA paths from
+ * currently, since there may be some lingering RNA paths from
* previous users needing freeing
*/
- DRIVER_TARGETS_LOOPER(dvar)
+ DRIVER_TARGETS_LOOPER(dvar)
{
/* free RNA path if applicable */
if (dtar->rna_path)
MEM_freeN(dtar->rna_path);
}
DRIVER_TARGETS_LOOPER_END
-
+
/* remove the variable from the driver */
BLI_freelinkN(variables, dvar);
}
@@ -1693,7 +1693,7 @@ void driver_free_variable_ex(ChannelDriver *driver, DriverVar *dvar)
{
/* remove and free the driver variable */
driver_free_variable(&driver->variables, dvar);
-
+
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
if (driver->type == DRIVER_TYPE_PYTHON)
@@ -1706,10 +1706,10 @@ void driver_variables_copy(ListBase *dst_vars, const ListBase *src_vars)
{
BLI_assert(BLI_listbase_is_empty(dst_vars));
BLI_duplicatelist(dst_vars, src_vars);
-
+
for (DriverVar *dvar = dst_vars->first; dvar; dvar = dvar->next) {
/* need to go over all targets so that we don't leave any dangling paths */
- DRIVER_TARGETS_LOOPER(dvar)
+ DRIVER_TARGETS_LOOPER(dvar)
{
/* make a copy of target's rna path if available */
if (dtar->rna_path)
@@ -1723,25 +1723,25 @@ void driver_variables_copy(ListBase *dst_vars, const ListBase *src_vars)
void driver_change_variable_type(DriverVar *dvar, int type)
{
const DriverVarTypeInfo *dvti = get_dvar_typeinfo(type);
-
+
/* sanity check */
if (ELEM(NULL, dvar, dvti))
return;
-
+
/* set the new settings */
dvar->type = type;
dvar->num_targets = dvti->num_targets;
-
- /* make changes to the targets based on the defines for these types
+
+ /* make changes to the targets based on the defines for these types
* NOTE: only need to make sure the ones we're using here are valid...
*/
DRIVER_TARGETS_USED_LOOPER(dvar)
{
short flags = dvti->target_flags[tarIndex];
-
+
/* store the flags */
dtar->flag = flags;
-
+
/* object ID types only, or idtype not yet initialized */
if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0))
dtar->idtype = ID_OB;
@@ -1758,19 +1758,19 @@ void driver_variable_name_validate(DriverVar *dvar)
'/', '\\', '?', ':', ';', '<', '>', '{', '}', '[', ']', '|',
' ', '.', '\t', '\n', '\r'
};
-
+
/* sanity checks */
if (dvar == NULL)
return;
-
+
/* clear all invalid-name flags */
dvar->flag &= ~DVAR_ALL_INVALID_FLAGS;
-
+
/* 0) Zero-length identifiers are not allowed */
if (dvar->name[0] == '\0') {
dvar->flag |= DVAR_FLAG_INVALID_EMPTY;
}
-
+
/* 1) Must start with a letter */
/* XXX: We assume that valid unicode letters in other languages are ok too, hence the blacklisting */
if (IN_RANGE_INCL(dvar->name[0], '0', '9')) {
@@ -1780,7 +1780,7 @@ void driver_variable_name_validate(DriverVar *dvar)
/* NOTE: We don't allow names to start with underscores (i.e. it helps when ruling out security risks) */
dvar->flag |= DVAR_FLAG_INVALID_START_CHAR;
}
-
+
/* 2) Must not contain invalid stuff in the middle of the string */
if (strchr(dvar->name, ' ')) {
dvar->flag |= DVAR_FLAG_INVALID_HAS_SPACE;
@@ -1788,17 +1788,17 @@ void driver_variable_name_validate(DriverVar *dvar)
if (strchr(dvar->name, '.')) {
dvar->flag |= DVAR_FLAG_INVALID_HAS_DOT;
}
-
+
/* 3) Check for special characters - Either at start, or in the middle */
for (int i = 0; i < sizeof(special_char_blacklist); i++) {
char *match = strchr(dvar->name, special_char_blacklist[i]);
-
+
if (match == dvar->name)
dvar->flag |= DVAR_FLAG_INVALID_START_CHAR;
else if (match != NULL)
dvar->flag |= DVAR_FLAG_INVALID_HAS_SPECIAL;
}
-
+
/* 4) Check if the name is a reserved keyword
* NOTE: These won't confuse Python, but it will be impossible to use the variable
* in an expression without Python misinterpreting what these are for
@@ -1818,29 +1818,29 @@ void driver_variable_name_validate(DriverVar *dvar)
DriverVar *driver_add_new_variable(ChannelDriver *driver)
{
DriverVar *dvar;
-
+
/* sanity checks */
if (driver == NULL)
return NULL;
-
+
/* make a new variable */
dvar = MEM_callocN(sizeof(DriverVar), "DriverVar");
BLI_addtail(&driver->variables, dvar);
-
+
/* give the variable a 'unique' name */
strcpy(dvar->name, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "var"));
BLI_uniquename(&driver->variables, dvar, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "var"), '_',
offsetof(DriverVar, name), sizeof(dvar->name));
-
+
/* set the default type to 'single prop' */
driver_change_variable_type(dvar, DVAR_TYPE_SINGLE_PROP);
-
+
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
if (driver->type == DRIVER_TYPE_PYTHON)
driver->flag |= DRIVER_FLAG_RENAMEVAR;
#endif
-
+
/* return the target */
return dvar;
}
@@ -1850,12 +1850,12 @@ void fcurve_free_driver(FCurve *fcu)
{
ChannelDriver *driver;
DriverVar *dvar, *dvarn;
-
+
/* sanity checks */
if (ELEM(NULL, fcu, fcu->driver))
return;
driver = fcu->driver;
-
+
/* free driver targets */
for (dvar = driver->variables.first; dvar; dvar = dvarn) {
dvarn = dvar->next;
@@ -1877,19 +1877,19 @@ void fcurve_free_driver(FCurve *fcu)
ChannelDriver *fcurve_copy_driver(const ChannelDriver *driver)
{
ChannelDriver *ndriver;
-
+
/* sanity checks */
if (driver == NULL)
return NULL;
-
+
/* copy all data */
ndriver = MEM_dupallocN(driver);
ndriver->expr_comp = NULL;
-
+
/* copy variables */
- BLI_listbase_clear(&ndriver->variables); /* to get rid of refs to non-copied data (that's still used on original) */
+ BLI_listbase_clear(&ndriver->variables); /* to get rid of refs to non-copied data (that's still used on original) */
driver_variables_copy(&ndriver->variables, &driver->variables);
-
+
/* return the new driver */
return ndriver;
}
@@ -1904,18 +1904,18 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar)
/* sanity check */
if (ELEM(NULL, driver, dvar))
return 0.0f;
-
- /* call the relevant callbacks to get the variable value
+
+ /* call the relevant callbacks to get the variable value
* using the variable type info, storing the obtained value
* in dvar->curval so that drivers can be debugged
*/
dvti = get_dvar_typeinfo(dvar->type);
-
+
if (dvti && dvti->get_value)
dvar->curval = dvti->get_value(driver, dvar);
else
dvar->curval = 0.0f;
-
+
return dvar->curval;
}
@@ -1926,11 +1926,11 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar)
float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const float evaltime)
{
DriverVar *dvar;
-
+
/* check if driver can be evaluated */
if (driver->flag & DRIVER_FLAG_INVALID)
return 0.0f;
-
+
switch (driver->type) {
case DRIVER_TYPE_AVERAGE: /* average values of driver targets */
case DRIVER_TYPE_SUM: /* sum values of driver targets */
@@ -1945,13 +1945,13 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
/* more than one target, so average the values of the targets */
float value = 0.0f;
int tot = 0;
-
+
/* loop through targets, adding (hopefully we don't get any overflow!) */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
value += driver_get_variable_value(driver, dvar);
tot++;
}
-
+
/* perform operations on the total if appropriate */
if (driver->type == DRIVER_TYPE_AVERAGE)
driver->curval = tot ? (value / (float)tot) : 0.0f;
@@ -1964,23 +1964,23 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
case DRIVER_TYPE_MAX: /* largest value */
{
float value = 0.0f;
-
+
/* loop through the variables, getting the values and comparing them to existing ones */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
/* get value */
float tmp_val = driver_get_variable_value(driver, dvar);
-
+
/* store this value if appropriate */
if (dvar->prev) {
/* check if greater/smaller than the baseline */
if (driver->type == DRIVER_TYPE_MAX) {
/* max? */
- if (tmp_val > value)
+ if (tmp_val > value)
value = tmp_val;
}
else {
/* min? */
- if (tmp_val < value)
+ if (tmp_val < value)
value = tmp_val;
}
}
@@ -1989,7 +1989,7 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
value = tmp_val;
}
}
-
+
/* store value in driver */
driver->curval = value;
break;
@@ -2020,14 +2020,14 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
}
default:
{
- /* special 'hack' - just use stored value
+ /* special 'hack' - just use stored value
* This is currently used as the mechanism which allows animated settings to be able
* to be changed via the UI.
*/
break;
}
}
-
+
/* return value for driver */
return driver->curval;
}
@@ -2041,15 +2041,15 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2])
{
float h1[2], h2[2], len1, len2, len, fac;
-
+
/* calculate handle deltas */
h1[0] = v1[0] - v2[0];
h1[1] = v1[1] - v2[1];
-
+
h2[0] = v4[0] - v3[0];
h2[1] = v4[1] - v3[1];
-
- /* calculate distances:
+
+ /* calculate distances:
* - len = span of time between keyframes
* - len1 = length of handle of start key
* - len2 = length of handle of end key
@@ -2057,20 +2057,20 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2])
len = v4[0] - v1[0];
len1 = fabsf(h1[0]);
len2 = fabsf(h2[0]);
-
+
/* if the handles have no length, no need to do any corrections */
if ((len1 + len2) == 0.0f)
return;
-
+
/* the two handles cross over each other, so force them
- * apart using the proportion they overlap
+ * apart using the proportion they overlap
*/
if ((len1 + len2) > len) {
fac = len / (len1 + len2);
-
+
v2[0] = (v1[0] - fac * h1[0]);
v2[1] = (v1[1] - fac * h1[1]);
-
+
v3[0] = (v4[0] - fac * h2[0]);
v3[1] = (v4[1] - fac * h2[1]);
}
@@ -2086,7 +2086,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
c1 = 3.0f * (q1 - q0);
c2 = 3.0f * (q0 - 2.0f * q1 + q2);
c3 = q3 - q0 + 3.0f * (q1 - q2);
-
+
if (c3 != 0.0) {
a = c2 / c3;
b = c1 / c3;
@@ -2096,21 +2096,21 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
p = b / 3 - a * a;
q = (2 * a * a * a - a * b + c) / 2;
d = q * q + p * p * p;
-
+
if (d > 0.0) {
t = sqrt(d);
o[0] = (float)(sqrt3d(-q + t) + sqrt3d(-q - t) - a);
-
+
if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1;
else return 0;
}
else if (d == 0.0) {
t = sqrt3d(-q);
o[0] = (float)(2 * t - a);
-
+
if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++;
o[nr] = (float)(-t - a);
-
+
if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1;
else return nr;
}
@@ -2120,13 +2120,13 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
p = cos(phi / 3);
q = sqrt(3 - 3 * p * p);
o[0] = (float)(2 * t * p - a);
-
+
if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++;
o[nr] = (float)(-t * (p + q) - a);
-
+
if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) nr++;
o[nr] = (float)(-t * (p - q) - a);
-
+
if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1;
else return nr;
}
@@ -2135,18 +2135,18 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
a = c2;
b = c1;
c = c0;
-
+
if (a != 0.0) {
/* discriminant */
p = b * b - 4 * a * c;
-
+
if (p > 0) {
p = sqrt(p);
o[0] = (float)((-b - p) / (2 * a));
-
+
if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++;
o[nr] = (float)((-b + p) / (2 * a));
-
+
if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1;
else return nr;
}
@@ -2158,7 +2158,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
}
else if (b != 0.0) {
o[0] = (float)(-c / b);
-
+
if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1;
else return 0;
}
@@ -2166,7 +2166,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o)
o[0] = 0.0;
return 1;
}
-
+
return 0;
}
}
@@ -2217,13 +2217,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
unsigned int a;
int b;
float cvalue = 0.0f;
-
+
/* get pointers */
a = fcu->totvert - 1;
prevbezt = bezts;
bezt = prevbezt + 1;
lastbezt = prevbezt + a;
-
+
/* evaluation time at or past endpoints? */
if (prevbezt->vec[1][0] >= evaltime) {
/* before or on first keyframe */
@@ -2233,7 +2233,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
/* linear or bezier interpolation */
if (prevbezt->ipo == BEZT_IPO_LIN) {
/* Use the next center point instead of our own handle for
- * linear interpolated extrapolate
+ * linear interpolated extrapolate
*/
if (fcu->totvert == 1) {
cvalue = prevbezt->vec[1][1];
@@ -2242,7 +2242,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
bezt = prevbezt + 1;
dx = prevbezt->vec[1][0] - evaltime;
fac = bezt->vec[1][0] - prevbezt->vec[1][0];
-
+
/* prevent division by zero */
if (fac) {
fac = (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
@@ -2259,7 +2259,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
*/
dx = prevbezt->vec[1][0] - evaltime;
fac = prevbezt->vec[1][0] - prevbezt->vec[0][0];
-
+
/* prevent division by zero */
if (fac) {
fac = (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac;
@@ -2271,8 +2271,8 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
}
}
else {
- /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation,
- * so just extend first keyframe's value
+ /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation,
+ * so just extend first keyframe's value
*/
cvalue = prevbezt->vec[1][1];
}
@@ -2285,7 +2285,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
/* linear or bezier interpolation */
if (lastbezt->ipo == BEZT_IPO_LIN) {
/* Use the next center point instead of our own handle for
- * linear interpolated extrapolate
+ * linear interpolated extrapolate
*/
if (fcu->totvert == 1) {
cvalue = lastbezt->vec[1][1];
@@ -2294,7 +2294,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
prevbezt = lastbezt - 1;
dx = evaltime - lastbezt->vec[1][0];
fac = lastbezt->vec[1][0] - prevbezt->vec[1][0];
-
+
/* prevent division by zero */
if (fac) {
fac = (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
@@ -2311,7 +2311,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
*/
dx = evaltime - lastbezt->vec[1][0];
fac = lastbezt->vec[2][0] - lastbezt->vec[1][0];
-
+
/* prevent division by zero */
if (fac) {
fac = (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac;
@@ -2323,8 +2323,8 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
}
}
else {
- /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation,
- * so just extend last keyframe's value
+ /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation,
+ * so just extend last keyframe's value
*/
cvalue = lastbezt->vec[1][1];
}
@@ -2332,9 +2332,9 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
else {
/* evaltime occurs somewhere in the middle of the curve */
bool exact = false;
-
+
/* Use binary search to find appropriate keyframes...
- *
+ *
* The threshold here has the following constraints:
* - 0.001 is too coarse -> We get artifacts with 2cm driver movements at 1BU = 1m (see T40332)
* - 0.00001 is too fine -> Weird errors, like selecting the wrong keyframe range (see T39207), occur.
@@ -2342,9 +2342,9 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
*/
a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.0001, &exact);
if (G.debug & G_DEBUG) printf("eval fcurve '%s' - %f => %u/%u, %d\n", fcu->rna_path, evaltime, a, fcu->totvert, exact);
-
+
if (exact) {
- /* index returned must be interpreted differently when it sits on top of an existing keyframe
+ /* index returned must be interpreted differently when it sits on top of an existing keyframe
* - that keyframe is the start of the segment we need (see action_bug_2.blend in T39207)
*/
prevbezt = bezts + a;
@@ -2357,7 +2357,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
bezt = bezts + a;
prevbezt = (a > 0) ? (bezt - 1) : bezt;
}
-
+
/* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */
/* XXX: consult T39207 for examples of files where failure of these checks can cause issues */
if (exact) {
@@ -2374,7 +2374,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
const float time = evaltime - prevbezt->vec[1][0];
const float amplitude = prevbezt->amplitude;
const float period = prevbezt->period;
-
+
/* value depends on interpolation mode */
if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES) || (duration == 0)) {
/* constant (evaltime not relevant, so no interpolation needed) */
@@ -2395,7 +2395,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
v3[1] = bezt->vec[0][1];
v4[0] = bezt->vec[1][0];
v4[1] = bezt->vec[1][1];
-
+
if (fabsf(v1[1] - v4[1]) < FLT_EPSILON &&
fabsf(v2[1] - v3[1]) < FLT_EPSILON &&
fabsf(v3[1] - v4[1]) < FLT_EPSILON)
@@ -2408,7 +2408,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
else {
/* adjust handles so that they don't overlap (forming a loop) */
correct_bezpart(v1, v2, v3, v4);
-
+
/* try to get a value for this position - if failure, try another set of points */
b = findzero(evaltime, v1[0], v2[0], v3[0], v4[0], opl);
if (b) {
@@ -2421,12 +2421,12 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
}
}
break;
-
+
case BEZT_IPO_LIN:
/* linear - simply linearly interpolate between values of the two keyframes */
cvalue = BLI_easing_linear_ease(time, begin, change, duration);
break;
-
+
/* easing ............................................ */
case BEZT_IPO_BACK:
switch (prevbezt->easing) {
@@ -2439,13 +2439,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_back_ease_in_out(time, begin, change, duration, prevbezt->back);
break;
-
+
default: /* default/auto: same as ease out */
cvalue = BLI_easing_back_ease_out(time, begin, change, duration, prevbezt->back);
break;
}
break;
-
+
case BEZT_IPO_BOUNCE:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2457,13 +2457,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_bounce_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease out */
cvalue = BLI_easing_bounce_ease_out(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_CIRC:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2475,7 +2475,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_circ_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_circ_ease_in(time, begin, change, duration);
break;
@@ -2493,13 +2493,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_cubic_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_cubic_ease_in(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_ELASTIC:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2511,13 +2511,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_elastic_ease_in_out(time, begin, change, duration, amplitude, period);
break;
-
+
default: /* default/auto: same as ease out */
cvalue = BLI_easing_elastic_ease_out(time, begin, change, duration, amplitude, period);
break;
}
break;
-
+
case BEZT_IPO_EXPO:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2529,13 +2529,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_expo_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_expo_ease_in(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_QUAD:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2547,13 +2547,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_quad_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_quad_ease_in(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_QUART:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2565,13 +2565,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_quart_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_quart_ease_in(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_QUINT:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2583,13 +2583,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_quint_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_quint_ease_in(time, begin, change, duration);
break;
}
break;
-
+
case BEZT_IPO_SINE:
switch (prevbezt->easing) {
case BEZT_IPO_EASE_IN:
@@ -2601,14 +2601,14 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
case BEZT_IPO_EASE_IN_OUT:
cvalue = BLI_easing_sine_ease_in_out(time, begin, change, duration);
break;
-
+
default: /* default/auto: same as ease in */
cvalue = BLI_easing_sine_ease_in(time, begin, change, duration);
break;
}
break;
-
-
+
+
default:
cvalue = prevbezt->vec[1][1];
break;
@@ -2619,7 +2619,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
if (G.debug & G_DEBUG) printf(" ERROR: failed eval - p=%f b=%f, t=%f (%f)\n", prevbezt->vec[1][0], bezt->vec[1][0], evaltime, fabsf(bezt->vec[1][0] - evaltime));
}
}
-
+
/* return value */
return cvalue;
}
@@ -2629,11 +2629,11 @@ static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime)
{
FPoint *prevfpt, *lastfpt, *fpt;
float cvalue = 0.0f;
-
+
/* get pointers */
prevfpt = fpts;
lastfpt = prevfpt + fcu->totvert - 1;
-
+
/* evaluation time at or past endpoints? */
if (prevfpt->vec[0] >= evaltime) {
/* before or on first sample, so just extend value */
@@ -2645,24 +2645,24 @@ static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime)
}
else {
float t = fabsf(evaltime - floorf(evaltime));
-
+
/* find the one on the right frame (assume that these are spaced on 1-frame intervals) */
fpt = prevfpt + ((int)evaltime - (int)prevfpt->vec[0]);
-
+
/* if not exactly on the frame, perform linear interpolation with the next one */
if ((t != 0.0f) && (t < 1.0f))
cvalue = interpf(fpt->vec[1], (fpt + 1)->vec[1], 1.0f - t);
else
cvalue = fpt->vec[1];
}
-
+
/* return value */
return cvalue;
}
/* ***************************** F-Curve - Evaluation ********************************* */
-/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime")
+/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime")
* Note: this is also used for drivers
*/
static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue)
@@ -2673,16 +2673,16 @@ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue)
/* evaluate modifiers which modify time to evaluate the base curve at */
storage = evaluate_fmodifiers_storage_new(&fcu->modifiers);
devaltime = evaluate_time_fmodifiers(storage, &fcu->modifiers, fcu, cvalue, evaltime);
-
- /* evaluate curve-data
- * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying
+
+ /* evaluate curve-data
+ * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying
* F-Curve modifier on the stack requested the curve to be evaluated at
*/
if (fcu->bezt)
cvalue = fcurve_eval_keyframes(fcu, fcu->bezt, devaltime);
else if (fcu->fpt)
cvalue = fcurve_eval_samples(fcu, fcu->fpt, devaltime);
-
+
/* evaluate modifiers */
evaluate_value_fmodifiers(storage, &fcu->modifiers, fcu, &cvalue, devaltime);
@@ -2693,7 +2693,7 @@ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue)
*/
if (fcu->flag & FCURVE_INT_VALUES)
cvalue = floorf(cvalue + 0.5f);
-
+
/* return evaluated value */
return cvalue;
}
@@ -2753,7 +2753,7 @@ float evaluate_fcurve_driver(PathResolvedRNA *anim_rna, FCurve *fcu, float evalt
/* Calculate the value of the given F-Curve at the given frame, and set its curval */
float calculate_fcurve(PathResolvedRNA *anim_rna, FCurve *fcu, float evaltime)
{
- /* only calculate + set curval (overriding the existing value) if curve has
+ /* only calculate + set curval (overriding the existing value) if curve has
* any data which warrants this...
*/
if ((fcu->totvert) || (fcu->driver && !(fcu->driver->flag & DRIVER_FLAG_INVALID)) ||
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index f3d0a5fe085..b69bce088d2 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -67,7 +67,7 @@ void *fmodifiers_storage_get(FModifierStackStorage *storage, FModifier *fcm);
* times. In addition to this, each modifier should have a type-info struct, where
* its functions are attached for use.
*/
-
+
/* Template for type-info data:
* - make a copy of this when creating new modifiers, and just change the functions
* pointed to as necessary
@@ -110,7 +110,7 @@ static FModifierTypeInfo FMI_MODNAME = {
static void fcm_generator_free(FModifier *fcm)
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
-
+
/* free polynomial coefficients array */
if (data->coefficients)
MEM_freeN(data->coefficients);
@@ -120,7 +120,7 @@ static void fcm_generator_copy(FModifier *fcm, const FModifier *src)
{
FMod_Generator *gen = (FMod_Generator *)fcm->data;
FMod_Generator *ogen = (FMod_Generator *)src->data;
-
+
/* copy coefficients array? */
if (ogen->coefficients)
gen->coefficients = MEM_dupallocN(ogen->coefficients);
@@ -130,19 +130,19 @@ static void fcm_generator_new_data(void *mdata)
{
FMod_Generator *data = (FMod_Generator *)mdata;
float *cp;
-
+
/* set default generator to be linear 0-1 (gradient = 1, y-offset = 0) */
data->poly_order = 1;
data->arraysize = 2;
cp = data->coefficients = MEM_callocN(sizeof(float) * 2, "FMod_Generator_Coefs");
- cp[0] = 0; // y-offset
+ cp[0] = 0; // y-offset
cp[1] = 1; // gradient
}
static void fcm_generator_verify(FModifier *fcm)
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
-
+
/* requirements depend on mode */
switch (data->mode) {
case FCM_GENERATOR_POLYNOMIAL: /* expanded polynomial expression */
@@ -173,8 +173,8 @@ static void fcm_generator_verify(FModifier *fcm)
static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
-
- /* behavior depends on mode
+
+ /* behavior depends on mode
* NOTE: the data in its default state is fine too
*/
switch (data->mode) {
@@ -184,8 +184,8 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c
float *powers = MEM_callocN(sizeof(float) * data->arraysize, "Poly Powers");
float value = 0.0f;
unsigned int i;
-
- /* for each x^n, precalculate value based on previous one first... this should be
+
+ /* for each x^n, precalculate value based on previous one first... this should be
* faster that calling pow() for each entry
*/
for (i = 0; i < data->arraysize; i++) {
@@ -195,11 +195,11 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c
else
powers[0] = 1;
}
-
+
/* for each coefficient, add to value, which we'll write to *cvalue in one go */
for (i = 0; i < data->arraysize; i++)
value += data->coefficients[i] * powers[i];
-
+
/* only if something changed, write *cvalue in one go */
if (data->poly_order) {
if (data->flag & FCM_GENERATOR_ADDITIVE)
@@ -207,9 +207,9 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c
else
*cvalue = value;
}
-
+
/* cleanup */
- if (powers)
+ if (powers)
MEM_freeN(powers);
break;
}
@@ -217,11 +217,11 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c
{
float value = 1.0f, *cp = NULL;
unsigned int i;
-
+
/* for each coefficient pair, solve for that bracket before accumulating in value by multiplying */
for (cp = data->coefficients, i = 0; (cp) && (i < (unsigned int)data->poly_order); cp += 2, i++)
value *= (cp[0] * evaltime + cp[1]);
-
+
/* only if something changed, write *cvalue in one go */
if (data->poly_order) {
if (data->flag & FCM_GENERATOR_ADDITIVE)
@@ -266,7 +266,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
static void fcm_fn_generator_new_data(void *mdata)
{
FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)mdata;
-
+
/* set amplitude and phase multiplier to 1.0f so that something is generated */
data->amplitude = 1.0f;
data->phase_multiplier = 1.0f;
@@ -289,9 +289,9 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data;
double arg = data->phase_multiplier * evaltime + data->phase_offset;
double (*fn)(double v) = NULL;
-
+
/* get function pointer to the func to use:
- * WARNING: must perform special argument validation hereto guard against crashes
+ * WARNING: must perform special argument validation hereto guard against crashes
*/
switch (data->type) {
/* simple ones */
@@ -304,7 +304,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
case FCM_GENERATOR_FN_SINC: /* normalized sine wave */
fn = sinc;
break;
-
+
/* validation required */
case FCM_GENERATOR_FN_TAN: /* tangent wave */
{
@@ -346,11 +346,11 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
break;
}
-
+
/* execute function callback to set value if appropriate */
if (fn) {
float value = (float)(data->amplitude * (float)fn(arg) + data->value_offset);
-
+
if (data->flag & FCM_GENERATOR_ADDITIVE)
*cvalue += value;
else
@@ -380,7 +380,7 @@ static FModifierTypeInfo FMI_FN_GENERATOR = {
static void fcm_envelope_free(FModifier *fcm)
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
-
+
/* free envelope data array */
if (env->data)
MEM_freeN(env->data);
@@ -390,7 +390,7 @@ static void fcm_envelope_copy(FModifier *fcm, const FModifier *src)
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FMod_Envelope *oenv = (FMod_Envelope *)src->data;
-
+
/* copy envelope data array */
if (oenv->data)
env->data = MEM_dupallocN(oenv->data);
@@ -399,7 +399,7 @@ static void fcm_envelope_copy(FModifier *fcm, const FModifier *src)
static void fcm_envelope_new_data(void *mdata)
{
FMod_Envelope *env = (FMod_Envelope *)mdata;
-
+
/* set default min/max ranges */
env->min = -1.0f;
env->max = 1.0f;
@@ -408,7 +408,7 @@ static void fcm_envelope_new_data(void *mdata)
static void fcm_envelope_verify(FModifier *fcm)
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
-
+
/* if the are points, perform bubble-sort on them, as user may have changed the order */
if (env->data) {
/* XXX todo... */
@@ -421,13 +421,13 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv
FCM_EnvelopeData *fed, *prevfed, *lastfed;
float min = 0.0f, max = 0.0f, fac = 0.0f;
int a;
-
+
/* get pointers */
if (env->data == NULL) return;
prevfed = env->data;
fed = prevfed + 1;
lastfed = prevfed + (env->totvert - 1);
-
+
/* get min/max values for envelope at evaluation time (relative to mid-value) */
if (prevfed->time >= evaltime) {
/* before or on first sample, so just extend value */
@@ -446,20 +446,20 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv
/* evaltime occurs within the interval defined by these two envelope points */
if ((prevfed->time <= evaltime) && (fed->time >= evaltime)) {
float afac, bfac, diff;
-
+
diff = fed->time - prevfed->time;
afac = (evaltime - prevfed->time) / diff;
bfac = (fed->time - evaltime) / diff;
-
+
min = bfac * prevfed->min + afac * fed->min;
max = bfac * prevfed->max + afac * fed->max;
-
+
break;
}
}
}
-
- /* adjust *cvalue
+
+ /* adjust *cvalue
* - fac is the ratio of how the current y-value corresponds to the reference range
* - thus, the new value is found by mapping the old range to the new!
*/
@@ -572,7 +572,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* Cycles F-Curve Modifier --------------------------- */
-/* This modifier changes evaltime to something that exists within the curve's frame-range,
+/* This modifier changes evaltime to something that exists within the curve's frame-range,
* then re-evaluates modifier stack up to this point using the new time. This re-entrant behavior
* is very likely to be more time-consuming than the original approach... (which was tightly integrated into
* the calculation code...).
@@ -588,11 +588,11 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
typedef struct tFCMED_Cycles {
float cycyofs; /* y-offset to apply */
} tFCMED_Cycles;
-
+
static void fcm_cycles_new_data(void *mdata)
{
FMod_Cycles *data = (FMod_Cycles *)mdata;
-
+
/* turn on cycles by default */
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC;
}
@@ -605,38 +605,38 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
short side = 0, mode = 0;
int cycles = 0;
float ofs = 0;
-
+
/* check if modifier is first in stack, otherwise disable ourself... */
/* FIXME... */
if (fcm->prev) {
fcm->flag |= FMODIFIER_FLAG_DISABLED;
return evaltime;
}
-
+
/* calculate new evaltime due to cyclic interpolation */
if (fcu && fcu->bezt) {
BezTriple *prevbezt = fcu->bezt;
BezTriple *lastbezt = prevbezt + fcu->totvert - 1;
-
+
prevkey[0] = prevbezt->vec[1][0];
prevkey[1] = prevbezt->vec[1][1];
-
+
lastkey[0] = lastbezt->vec[1][0];
lastkey[1] = lastbezt->vec[1][1];
}
else if (fcu && fcu->fpt) {
FPoint *prevfpt = fcu->fpt;
FPoint *lastfpt = prevfpt + fcu->totvert - 1;
-
+
prevkey[0] = prevfpt->vec[0];
prevkey[1] = prevfpt->vec[1];
-
+
lastkey[0] = lastfpt->vec[0];
lastkey[1] = lastfpt->vec[1];
}
else
return evaltime;
-
+
/* check if modifier will do anything
* 1) if in data range, definitely don't do anything
* 2) if before first frame or after last frame, make sure some cycling is in use
@@ -659,26 +659,26 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
}
if ((ELEM(0, side, mode)))
return evaltime;
-
+
/* find relative place within a cycle */
{
float cycdx = 0, cycdy = 0;
float cycle = 0, cyct = 0;
-
+
/* calculate period and amplitude (total height) of a cycle */
cycdx = lastkey[0] - prevkey[0];
cycdy = lastkey[1] - prevkey[1];
-
+
/* check if cycle is infinitely small, to be point of being impossible to use */
if (cycdx == 0)
return evaltime;
-
+
/* calculate the 'number' of the cycle */
cycle = ((float)side * (evaltime - ofs) / cycdx);
-
+
/* calculate the time inside the cycle */
cyct = fmod(evaltime - ofs, cycdx);
-
+
/* check that cyclic is still enabled for the specified time */
if (cycles == 0) {
/* catch this case so that we don't exit when we have (cycles = 0)
@@ -687,11 +687,11 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
}
else if (cycle > cycles) {
/* we are too far away from range to evaluate
- * TODO: but we should still hold last value...
+ * TODO: but we should still hold last value...
*/
return evaltime;
}
-
+
/* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */
if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) {
if (side < 0)
@@ -700,17 +700,17 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
cycyofs = (float)ceil((evaltime - ofs) / cycdx);
cycyofs *= cycdy;
}
-
+
/* special case for cycle start/end */
if (cyct == 0.0f) {
evaltime = (side == 1 ? lastkey[0] : prevkey[0]);
-
+
if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
evaltime = (side == 1 ? prevkey[0] : lastkey[0]);
}
/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
else if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle + 1) % 2)) {
- /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse
+ /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse
* - for 'before' extrapolation, we need to flip in a different way, otherwise values past
* then end of the curve get referenced (result of fmod will be negative, and with different phase)
*/
@@ -725,22 +725,22 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
}
if (evaltime < prevkey[0]) evaltime += cycdx;
}
-
+
/* store temp data if needed */
if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) {
tFCMED_Cycles *edata;
-
+
/* for now, this is just a float, but we could get more stuff... */
edata = MEM_callocN(sizeof(tFCMED_Cycles), "tFCMED_Cycles");
edata->cycyofs = cycyofs;
fmodifiers_storage_put(storage, fcm, edata);
}
-
+
/* return the new frame to evaluate */
return evaltime;
}
-
+
static void fcm_cycles_evaluate(FModifierStackStorage *storage, FCurve *UNUSED(fcu),
FModifier *fcm, float *cvalue, float UNUSED(evaltime))
{
@@ -750,7 +750,7 @@ static void fcm_cycles_evaluate(FModifierStackStorage *storage, FCurve *UNUSED(f
if (edata) {
/* add cyclic offset - no need to check for now, otherwise the data wouldn't exist! */
*cvalue += edata->cycyofs;
-
+
/* free temp data */
MEM_freeN(edata);
fmodifiers_storage_remove(storage, fcm);
@@ -779,7 +779,7 @@ static FModifierTypeInfo FMI_CYCLES = {
static void fcm_noise_new_data(void *mdata)
{
FMod_Noise *data = (FMod_Noise *)mdata;
-
+
/* defaults */
data->size = 1.0f;
data->strength = 1.0f;
@@ -788,18 +788,18 @@ static void fcm_noise_new_data(void *mdata)
data->depth = 0;
data->modification = FCM_NOISE_MODIF_REPLACE;
}
-
+
static void fcm_noise_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_Noise *data = (FMod_Noise *)fcm->data;
float noise;
-
+
/* generate noise using good ol' Blender Noise
* - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1
* with evaltime being an integer (which happens when evaluating on frame by frame basis)
*/
noise = BLI_turbulence(data->size, evaltime - data->offset, data->phase, 0.1f, data->depth);
-
+
/* combine the noise with existing motion data */
switch (data->modification) {
case FCM_NOISE_MODIF_ADD:
@@ -837,7 +837,7 @@ static FModifierTypeInfo FMI_NOISE = {
/* Filter F-Curve Modifier --------------------------- */
-#if 0 // XXX not yet implemented
+#if 0 // XXX not yet implemented
static FModifierTypeInfo FMI_FILTER = {
FMODIFIER_TYPE_FILTER, /* type */
sizeof(FMod_Filter), /* size */
@@ -862,7 +862,7 @@ static FModifierTypeInfo FMI_FILTER = {
static void fcm_python_free(FModifier *fcm)
{
FMod_Python *data = (FMod_Python *)fcm->data;
-
+
/* id-properties */
IDP_FreeProperty(data->prop);
MEM_freeN(data->prop);
@@ -871,7 +871,7 @@ static void fcm_python_free(FModifier *fcm)
static void fcm_python_new_data(void *mdata)
{
FMod_Python *data = (FMod_Python *)mdata;
-
+
/* everything should be set correctly by calloc, except for the prop->type constant.*/
data->prop = MEM_callocN(sizeof(IDProperty), "PyFModifierProps");
data->prop->type = IDP_GROUP;
@@ -881,7 +881,7 @@ static void fcm_python_copy(FModifier *fcm, const FModifier *src)
{
FMod_Python *pymod = (FMod_Python *)fcm->data;
FMod_Python *opymod = (FMod_Python *)src->data;
-
+
pymod->prop = IDP_CopyProperty(opymod->prop);
}
@@ -889,9 +889,9 @@ static void fcm_python_evaluate(FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), flo
{
#ifdef WITH_PYTHON
//FMod_Python *data = (FMod_Python *)fcm->data;
-
+
/* FIXME... need to implement this modifier...
- * It will need it execute a script using the custom properties
+ * It will need it execute a script using the custom properties
*/
#endif /* WITH_PYTHON */
}
@@ -919,13 +919,13 @@ static FModifierTypeInfo FMI_PYTHON = {
static float fcm_limits_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime)
{
FMod_Limits *data = (FMod_Limits *)fcm->data;
-
+
/* check for the time limits */
if ((data->flag & FCM_LIMIT_XMIN) && (evaltime < data->rect.xmin))
return data->rect.xmin;
if ((data->flag & FCM_LIMIT_XMAX) && (evaltime > data->rect.xmax))
return data->rect.xmax;
-
+
/* modifier doesn't change time */
return evaltime;
}
@@ -933,7 +933,7 @@ static float fcm_limits_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(c
static void fcm_limits_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime))
{
FMod_Limits *data = (FMod_Limits *)fcm->data;
-
+
/* value limits now */
if ((data->flag & FCM_LIMIT_YMIN) && (*cvalue < data->rect.ymin))
*cvalue = data->rect.ymin;
@@ -944,7 +944,7 @@ static void fcm_limits_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cval
static FModifierTypeInfo FMI_LIMITS = {
FMODIFIER_TYPE_LIMITS, /* type */
sizeof(FMod_Limits), /* size */
- FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */
+ FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */
FMI_REQUIRES_RUNTIME_CHECK, /* requirements */
N_("Limits"), /* name */
"FMod_Limits", /* struct name */
@@ -963,7 +963,7 @@ static FModifierTypeInfo FMI_LIMITS = {
static void fcm_stepped_new_data(void *mdata)
{
FMod_Stepped *data = (FMod_Stepped *)mdata;
-
+
/* just need to set the step-size to 2-frames by default */
/* XXX: or would 5 be more normal? */
data->step_size = 2.0f;
@@ -973,7 +973,7 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(
{
FMod_Stepped *data = (FMod_Stepped *)fcm->data;
int snapblock;
-
+
/* check range clamping to see if we should alter the timing to achieve the desired results */
if (data->flag & FCM_STEPPED_NO_BEFORE) {
if (evaltime < data->start_frame)
@@ -983,15 +983,15 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(
if (evaltime > data->end_frame)
return evaltime;
}
-
- /* we snap to the start of the previous closest block of 'step_size' frames
- * after the start offset has been discarded
+
+ /* we snap to the start of the previous closest block of 'step_size' frames
+ * after the start offset has been discarded
* - i.e. round down
*/
snapblock = (int)((evaltime - data->offset) / data->step_size);
-
- /* reapply the offset, and multiple the snapblock by the size of the steps to get
- * the new time to evaluate at
+
+ /* reapply the offset, and multiple the snapblock by the size of the steps to get
+ * the new time to evaluate at
*/
return ((float)snapblock * data->step_size) + data->offset;
}
@@ -999,7 +999,7 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(
static FModifierTypeInfo FMI_STEPPED = {
FMODIFIER_TYPE_STEPPED, /* type */
sizeof(FMod_Limits), /* size */
- FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */
+ FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */
FMI_REQUIRES_RUNTIME_CHECK, /* requirements */
N_("Stepped"), /* name */
"FMod_Stepped", /* struct name */
@@ -1047,7 +1047,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type)
fmods_init_typeinfo();
FMI_INIT = 0;
}
-
+
/* only return for valid types */
if ((type >= FMODIFIER_TYPE_NULL) &&
(type < FMODIFIER_NUM_TYPES))
@@ -1058,10 +1058,10 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type)
else {
printf("No valid F-Curve Modifier type-info data available. Type = %i\n", type);
}
-
+
return NULL;
-}
-
+}
+
/* This function should always be used to get the appropriate type-info, as it
* has checks which prevent segfaults in some weird cases.
*/
@@ -1081,11 +1081,11 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
{
const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type);
FModifier *fcm;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, fmi))
return NULL;
-
+
/* special checks for whether modifier can be added */
if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) {
/* cycles modifier must be first in stack, so for now, don't add if it can't be */
@@ -1093,7 +1093,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n");
return NULL;
}
-
+
/* add modifier itself */
fcm = MEM_callocN(sizeof(FModifier), "F-Curve Modifier");
fcm->type = type;
@@ -1101,14 +1101,14 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
fcm->curve = owner_fcu;
fcm->influence = 1.0f;
BLI_addtail(modifiers, fcm);
-
+
/* tag modifier as "active" if no other modifiers exist in the stack yet */
if (BLI_listbase_is_single(modifiers))
fcm->flag |= FMODIFIER_FLAG_ACTIVE;
-
+
/* add modifier's data */
fcm->data = MEM_callocN(fmi->size, fmi->structName);
-
+
/* init custom settings if necessary */
if (fmi->new_data)
fmi->new_data(fcm->data);
@@ -1116,7 +1116,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
/* update the fcurve if the Cycles modifier is added */
if ((owner_fcu) && (type == FMODIFIER_TYPE_CYCLES))
calchandles_fcurve(owner_fcu);
-
+
/* return modifier for further editing */
return fcm;
}
@@ -1126,23 +1126,23 @@ FModifier *copy_fmodifier(const FModifier *src)
{
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(src);
FModifier *dst;
-
+
/* sanity check */
if (src == NULL)
return NULL;
-
+
/* copy the base data, clearing the links */
dst = MEM_dupallocN(src);
dst->next = dst->prev = NULL;
dst->curve = NULL;
-
+
/* make a new copy of the F-Modifier's data */
dst->data = MEM_dupallocN(src->data);
-
+
/* only do specific constraints if required */
if (fmi && fmi->copy_data)
fmi->copy_data(dst, src);
-
+
/* return the new modifier */
return dst;
}
@@ -1151,20 +1151,20 @@ FModifier *copy_fmodifier(const FModifier *src)
void copy_fmodifiers(ListBase *dst, const ListBase *src)
{
FModifier *fcm, *srcfcm;
-
+
if (ELEM(NULL, dst, src))
return;
-
+
BLI_listbase_clear(dst);
BLI_duplicatelist(dst, src);
-
+
for (fcm = dst->first, srcfcm = src->first; fcm && srcfcm; srcfcm = srcfcm->next, fcm = fcm->next) {
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
-
+
/* make a new copy of the F-Modifier's data */
fcm->data = MEM_dupallocN(fcm->data);
fcm->curve = NULL;
-
+
/* only do specific constraints if required */
if (fmi && fmi->copy_data)
fmi->copy_data(fcm, srcfcm);
@@ -1175,11 +1175,11 @@ void copy_fmodifiers(ListBase *dst, const ListBase *src)
bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
{
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
-
+
/* sanity check */
if (fcm == NULL)
return false;
-
+
/* removing the cycles modifier requires a handle update */
FCurve *update_fcu = (fcm->type == FMODIFIER_TYPE_CYCLES) ? fcm->curve : NULL;
@@ -1187,11 +1187,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
if (fcm->data) {
if (fmi && fmi->free_data)
fmi->free_data(fcm);
-
+
/* free modifier's data (fcm->data) */
MEM_freeN(fcm->data);
}
-
+
/* remove modifier from stack */
if (modifiers) {
BLI_freelinkN(modifiers, fcm);
@@ -1214,11 +1214,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
void free_fmodifiers(ListBase *modifiers)
{
FModifier *fcm, *fmn;
-
+
/* sanity check */
if (modifiers == NULL)
return;
-
+
/* free each modifier in order - modifier is unlinked from list and freed */
for (fcm = modifiers->first; fcm; fcm = fmn) {
fmn = fcm->next;
@@ -1230,17 +1230,17 @@ void free_fmodifiers(ListBase *modifiers)
FModifier *find_active_fmodifier(ListBase *modifiers)
{
FModifier *fcm;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
return NULL;
-
+
/* loop over modifiers until 'active' one is found */
for (fcm = modifiers->first; fcm; fcm = fcm->next) {
if (fcm->flag & FMODIFIER_FLAG_ACTIVE)
return fcm;
}
-
+
/* no modifier is active */
return NULL;
}
@@ -1249,55 +1249,55 @@ FModifier *find_active_fmodifier(ListBase *modifiers)
void set_active_fmodifier(ListBase *modifiers, FModifier *fcm)
{
FModifier *fm;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
return;
-
+
/* deactivate all, and set current one active */
for (fm = modifiers->first; fm; fm = fm->next)
fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
-
+
/* make given modifier active */
if (fcm)
fcm->flag |= FMODIFIER_FLAG_ACTIVE;
}
-/* Do we have any modifiers which match certain criteria
+/* Do we have any modifiers which match certain criteria
* - mtype - type of modifier (if 0, doesn't matter)
* - acttype - type of action to perform (if -1, doesn't matter)
*/
bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype)
{
FModifier *fcm;
-
+
/* if there are no specific filtering criteria, just skip */
if ((mtype == 0) && (acttype == 0))
return (modifiers && modifiers->first);
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
return false;
-
+
/* find the first mdifier fitting these criteria */
for (fcm = modifiers->first; fcm; fcm = fcm->next) {
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
short mOk = 1, aOk = 1; /* by default 1, so that when only one test, won't fail */
-
+
/* check if applicable ones are fullfilled */
if (mtype)
mOk = (fcm->type == mtype);
if (acttype > -1)
aOk = (fmi->acttype == acttype);
-
+
/* if both are ok, we've found a hit */
if (mOk && aOk)
return true;
}
-
+
/* no matches */
return false;
-}
+}
/* Evaluation API --------------------------- */
@@ -1359,19 +1359,19 @@ void *fmodifiers_storage_get(FModifierStackStorage *storage, FModifier *fcm)
static float eval_fmodifier_influence(FModifier *fcm, float evaltime)
{
float influence;
-
+
/* sanity check */
- if (fcm == NULL)
+ if (fcm == NULL)
return 0.0f;
-
- /* should we use influence stored in modifier or not
+
+ /* should we use influence stored in modifier or not
* NOTE: this is really just a hack so that we don't need to version patch old files ;)
*/
if (fcm->flag & FMODIFIER_FLAG_USEINFLUENCE)
influence = fcm->influence;
else
influence = 1.0f;
-
+
/* restricted range or full range? */
if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
if ((evaltime <= fcm->sfra) || (evaltime >= fcm->efra)) {
@@ -1391,7 +1391,7 @@ static float eval_fmodifier_influence(FModifier *fcm, float evaltime)
return influence * (evaltime - a) / (b - a);
}
}
-
+
/* just return the influence of the modifier */
return influence;
}
@@ -1411,7 +1411,7 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
FCurve *fcu, float cvalue, float evaltime)
{
FModifier *fcm;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->last))
return evaltime;
@@ -1419,22 +1419,22 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
if (fcu && fcu->flag & FCURVE_MOD_OFF)
return evaltime;
- /* Starting from the end of the stack, calculate the time effects of various stacked modifiers
- * on the time the F-Curve should be evaluated at.
+ /* Starting from the end of the stack, calculate the time effects of various stacked modifiers
+ * on the time the F-Curve should be evaluated at.
*
* This is done in reverse order to standard evaluation, as when this is done in standard
* order, each modifier would cause jumps to other points in the curve, forcing all
- * previous ones to be evaluated again for them to be correct. However, if we did in the
+ * previous ones to be evaluated again for them to be correct. However, if we did in the
* reverse order as we have here, we can consider them a macro to micro type of waterfall
* effect, which should get us the desired effects when using layered time manipulations
* (such as multiple 'stepped' modifiers in sequence, causing different stepping rates)
*/
for (fcm = modifiers->last; fcm; fcm = fcm->prev) {
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
-
- if (fmi == NULL)
+
+ if (fmi == NULL)
continue;
-
+
/* if modifier cannot be applied on this frame (whatever scale it is on, it won't affect the results)
* hence we shouldn't bother seeing what it would do given the chance
*/
@@ -1453,13 +1453,13 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
else {
nval = fmi->evaluate_modifier_time_storage(storage, fcu, fcm, cvalue, evaltime);
}
-
+
evaltime = interpf(nval, evaltime, influence);
}
}
}
}
-
+
/* return the modified evaltime */
return evaltime;
}
@@ -1471,21 +1471,21 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
FCurve *fcu, float *cvalue, float evaltime)
{
FModifier *fcm;
-
+
/* sanity checks */
if (ELEM(NULL, modifiers, modifiers->first))
return;
if (fcu->flag & FCURVE_MOD_OFF)
return;
-
+
/* evaluate modifiers */
for (fcm = modifiers->first; fcm; fcm = fcm->next) {
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
-
- if (fmi == NULL)
+
+ if (fmi == NULL)
continue;
-
+
/* only evaluate if there's a callback for this, and if F-Modifier can be evaluated on this frame */
if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 ||
((fcm->sfra <= evaltime) && (fcm->efra >= evaltime)) )
@@ -1507,7 +1507,7 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
}
}
}
-}
+}
/* ---------- */
@@ -1517,24 +1517,24 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
void fcurve_bake_modifiers(FCurve *fcu, int start, int end)
{
ChannelDriver *driver;
-
+
/* sanity checks */
/* TODO: make these tests report errors using reports not printf's */
if (ELEM(NULL, fcu, fcu->modifiers.first)) {
printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
return;
}
-
+
/* temporarily, disable driver while we sample, so that they don't influence the outcome */
driver = fcu->driver;
fcu->driver = NULL;
-
+
/* bake the modifiers, by sampling the curve at each frame */
fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
-
+
/* free the modifiers now */
free_fmodifiers(&fcu->modifiers);
-
+
/* restore driver */
fcu->driver = driver;
}
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 73199cebe36..cf2521509b5 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -148,7 +148,7 @@ static PackedFile *get_builtin_packedfile(void)
void *mem = MEM_mallocN(builtin_font_size, "vfd_builtin");
memcpy(mem, builtin_font_data, builtin_font_size);
-
+
return newPackedFileMemory(mem, builtin_font_size);
}
}
@@ -205,7 +205,7 @@ static VFontData *vfont_get_data(VFont *vfont)
pf = get_builtin_packedfile();
}
}
-
+
if (pf) {
vfont->data = BLI_vfontdata_from_freetypefont(pf);
if (pf != vfont->packedfile) {
@@ -246,10 +246,10 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
PackedFile *pf;
PackedFile *temp_pf = NULL;
bool is_builtin;
-
+
if (STREQ(filepath, FO_BUILTIN_NAME)) {
BLI_strncpy(filename, filepath, sizeof(filename));
-
+
pf = get_builtin_packedfile();
is_builtin = true;
}
@@ -257,7 +257,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
BLI_split_file_part(filepath, filename, sizeof(filename));
pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
-
+
is_builtin = false;
}
@@ -291,7 +291,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
freePackedFile(pf);
}
}
-
+
return vfont;
}
@@ -348,13 +348,13 @@ static VFont *which_vfont(Curve *cu, CharInfo *info)
VFont *BKE_vfont_builtin_get(void)
{
VFont *vfont;
-
+
for (vfont = G_MAIN->vfont.first; vfont; vfont = vfont->id.next) {
if (BKE_vfont_is_builtin(vfont)) {
return vfont;
}
}
-
+
return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME);
}
@@ -368,7 +368,7 @@ static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect,
{
Nurb *nu2;
BPoint *bp;
-
+
nu2 = (Nurb *) MEM_callocN(sizeof(Nurb), "underline_nurb");
nu2->resolu = cu->resolu;
nu2->bezt = NULL;
@@ -454,7 +454,7 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
co = cosf(rot);
che = find_vfont_char(vfd, character);
-
+
/* Select the glyph data */
if (che)
nu1 = che->nurbsbase.first;
@@ -488,10 +488,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
}
memcpy(bezt2, bezt1, i * sizeof(struct BezTriple));
nu2->bezt = bezt2;
-
+
if (shear != 0.0f) {
bezt2 = nu2->bezt;
-
+
for (i = nu2->pntsu; i > 0; i--) {
bezt2->vec[0][0] += shear * bezt2->vec[0][1];
bezt2->vec[1][0] += shear * bezt2->vec[1][1];
@@ -544,10 +544,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
fp[7] = (fp[7] + ofsy) * fsize;
bezt2++;
}
-
+
BLI_addtail(nubase, nu2);
}
-
+
nu1 = nu1->next;
}
}
@@ -557,7 +557,7 @@ int BKE_vfont_select_get(Object *ob, int *r_start, int *r_end)
Curve *cu = ob->data;
EditFont *ef = cu->editfont;
int start, end, direction;
-
+
if ((ob->type != OB_FONT) || (ef == NULL)) return 0;
BLI_assert(ef->len >= 0);
@@ -681,7 +681,7 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase,
/* The VFont Data can not be found */
if (!vfd) return ok;
-
+
if (ef) {
slen = ef->len;
mem = ef->textbuf;
@@ -734,9 +734,9 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase,
/* We assume the worst case: 1 character per line (is freed at end anyway) */
lineinfo = MEM_malloc_arrayN((slen * 2 + 1), sizeof(*lineinfo), "lineinfo");
-
+
linedist = cu->linedist;
-
+
curbox = 0;
textbox_scale(&tb_scale, &cu->tb[curbox], 1.0f / cu->fsize);
use_textbox = (tb_scale.w != 0.0f);
@@ -886,7 +886,7 @@ makebreak:
}
else if (ascii == 9) { /* TAB */
float tabfac;
-
+
ct->xof = xof;
ct->yof = yof;
ct->linenr = lnr;
@@ -911,27 +911,27 @@ makebreak:
sb->h = linedist * cu->fsize;
sb->w = xof * cu->fsize;
}
-
+
if (ascii == 32) {
- wsfac = cu->wordspace;
+ wsfac = cu->wordspace;
wsnr++;
}
else {
wsfac = 1.0f;
}
-
+
/* Set the width of the character */
twidth = char_width(cu, che, info);
xof += (twidth * wsfac * (1.0f + (info->kern / 40.0f)) ) + xtrax;
-
+
if (sb) {
sb->w = (xof * cu->fsize) - sb->w;
}
}
ct++;
}
-
+
cu->lines = 1;
for (i = 0; i <= slen; i++) {
ascii = mem[i];
@@ -1092,7 +1092,7 @@ makebreak:
copy_m3_m4(cmat, cu->textoncurve->obmat);
mul_m3_m3m3(cmat, cmat, imat3);
sizefac = normalize_v3(cmat[0]) / cu->fsize;
-
+
minx = miny = 1.0e20f;
maxx = maxy = -1.0e20f;
ct = chartransdata;
@@ -1102,17 +1102,17 @@ makebreak:
if (miny > ct->yof) miny = ct->yof;
if (maxy < ct->yof) maxy = ct->yof;
}
-
+
/* we put the x-coordinaat exact at the curve, the y is rotated */
-
+
/* length correction */
distfac = sizefac * cu->textoncurve->curve_cache->path->totdist / (maxx - minx);
timeofs = 0.0f;
-
+
if (distfac > 1.0f) {
/* path longer than text: spacemode involves */
distfac = 1.0f / distfac;
-
+
if (cu->spacemode == CU_ALIGN_X_RIGHT) {
timeofs = 1.0f - distfac;
}
@@ -1128,14 +1128,14 @@ makebreak:
}
distfac /= (maxx - minx);
-
+
timeofs += distfac * cu->xof; /* not cyclic */
-
+
ct = chartransdata;
for (i = 0; i < slen; i++, ct++) {
float ctime, dtime, vec[4], tvec[4], rotvec[3];
float si, co;
-
+
/* rotate around center character */
info = &custrinfo[i];
ascii = mem[i];
@@ -1144,7 +1144,7 @@ makebreak:
}
che = find_vfont_char(vfd, ascii);
-
+
twidth = char_width(cu, che, info);
dtime = distfac * 0.5f * twidth;
@@ -1156,16 +1156,16 @@ makebreak:
/* vec, tvec need 4 items */
where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL);
where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL);
-
+
mul_v3_fl(vec, sizefac);
-
+
ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]);
si = sinf(ct->rot);
co = cosf(ct->rot);
yof = ct->yof;
-
+
ct->xof = vec[0] + si * yof;
ct->yof = vec[1] + co * yof;
@@ -1224,29 +1224,29 @@ makebreak:
}
}
}
-
+
/* cursor first */
if (ef) {
float si, co;
-
+
ct = &chartransdata[ef->pos];
si = sinf(ct->rot);
co = cosf(ct->rot);
f = ef->textcurs[0];
-
+
f[0] = cu->fsize * (-0.1f * co + ct->xof);
f[1] = cu->fsize * ( 0.1f * si + ct->yof);
-
+
f[2] = cu->fsize * ( 0.1f * co + ct->xof);
f[3] = cu->fsize * (-0.1f * si + ct->yof);
-
+
f[4] = cu->fsize * ( 0.1f * co + 0.8f * si + ct->xof);
f[5] = cu->fsize * (-0.1f * si + 0.8f * co + ct->yof);
-
+
f[6] = cu->fsize * (-0.1f * co + 0.8f * si + ct->xof);
f[7] = cu->fsize * ( 0.1f * si + 0.8f * co + ct->yof);
-
+
}
if (mode == FO_SELCHANGE) {
@@ -1258,7 +1258,7 @@ makebreak:
if (mode == FO_EDIT) {
/* make nurbdata */
BKE_nurbList_free(r_nubase);
-
+
ct = chartransdata;
for (i = 0; i < slen; i++) {
unsigned int cha = (unsigned int) mem[i];
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6a59ea4439f..e89508fd6c0 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -27,7 +27,7 @@
* \ingroup bke
*/
-
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -96,14 +96,14 @@ bool BKE_gpencil_free_strokes(bGPDframe *gpf)
void BKE_gpencil_free_frames(bGPDlayer *gpl)
{
bGPDframe *gpf_next;
-
+
/* error checking */
if (gpl == NULL) return;
-
+
/* free frames */
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf_next) {
gpf_next = gpf->next;
-
+
/* free strokes and their associated memory */
BKE_gpencil_free_strokes(gpf);
BLI_freelinkN(&gpl->frames, gpf);
@@ -177,14 +177,14 @@ void BKE_gpencil_free_brushes(ListBase *list)
void BKE_gpencil_free_layers(ListBase *list)
{
bGPDlayer *gpl_next;
-
+
/* error checking */
if (list == NULL) return;
-
+
/* delete layers */
for (bGPDlayer *gpl = list->first; gpl; gpl = gpl_next) {
gpl_next = gpl->next;
-
+
/* free layers and their data */
BKE_gpencil_free_frames(gpl);
BLI_freelinkN(list, gpl);
@@ -212,15 +212,15 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
{
bGPDframe *gpf = NULL, *gf = NULL;
short state = 0;
-
+
/* error checking */
if (gpl == NULL)
return NULL;
-
+
/* allocate memory for this frame */
gpf = MEM_callocN(sizeof(bGPDframe), "bGPDframe");
gpf->framenum = cframe;
-
+
/* find appropriate place to add frame */
if (gpl->frames.first) {
for (gf = gpl->frames.first; gf; gf = gf->next) {
@@ -229,7 +229,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
state = -1;
break;
}
-
+
/* if current frame has already exceeded the frame to add, add before */
if (gf->framenum > cframe) {
BLI_insertlinkbefore(&gpl->frames, gf, gpf);
@@ -238,14 +238,14 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
}
}
}
-
+
/* check whether frame was added successfully */
if (state == -1) {
printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe);
-
+
/* free the newly created one, and use the old one instead */
MEM_freeN(gpf);
-
+
/* return existing frame instead... */
BLI_assert(gf != NULL);
gpf = gf;
@@ -254,7 +254,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
/* add to end then! */
BLI_addtail(&gpl->frames, gpf);
}
-
+
/* return frame */
return gpf;
}
@@ -264,7 +264,7 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
{
bGPDframe *new_frame;
bool found = false;
-
+
/* Error checking/handling */
if (gpl == NULL) {
/* no layer */
@@ -274,16 +274,16 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
/* no active frame, so just create a new one from scratch */
return BKE_gpencil_frame_addnew(gpl, cframe);
}
-
+
/* Create a copy of the frame */
new_frame = BKE_gpencil_frame_duplicate(gpl->actframe);
-
+
/* Find frame to insert it before */
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
if (gpf->framenum > cframe) {
/* Add it here */
BLI_insertlinkbefore(&gpl->frames, gpf, new_frame);
-
+
found = true;
break;
}
@@ -294,23 +294,23 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
BKE_gpencil_free_strokes(new_frame);
MEM_freeN(new_frame);
new_frame = NULL;
-
+
found = true;
break;
}
}
-
+
if (found == false) {
/* Add new frame to the end */
BLI_addtail(&gpl->frames, new_frame);
}
-
+
/* Ensure that frame is set up correctly, and return it */
if (new_frame) {
new_frame->framenum = cframe;
gpl->actframe = new_frame;
}
-
+
return new_frame;
}
@@ -318,17 +318,17 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive)
{
bGPDlayer *gpl;
-
+
/* check that list is ok */
if (gpd == NULL)
return NULL;
-
+
/* allocate memory for frame and add to end of list */
gpl = MEM_callocN(sizeof(bGPDlayer), "bGPDlayer");
-
+
/* add to datablock */
BLI_addtail(&gpd->layers, gpl);
-
+
/* set basic settings */
copy_v4_v4(gpl->color, U.gpencil_new_layer_col);
/* Since GPv2 thickness must be 0 */
@@ -339,23 +339,23 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti
/* onion-skinning settings */
if (gpd->flag & GP_DATA_SHOW_ONIONSKINS)
gpl->flag |= GP_LAYER_ONIONSKIN;
-
+
gpl->flag |= (GP_LAYER_GHOST_PREVCOL | GP_LAYER_GHOST_NEXTCOL);
-
+
ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.145098f, 0.419608f, 0.137255f); /* green */
ARRAY_SET_ITEMS(gpl->gcolor_next, 0.125490f, 0.082353f, 0.529412f); /* blue */
-
+
/* high quality fill by default */
gpl->flag |= GP_LAYER_HQ_FILL;
-
+
/* auto-name */
BLI_strncpy(gpl->info, name, sizeof(gpl->info));
BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
-
+
/* make this one the active one */
if (setactive)
BKE_gpencil_layer_setactive(gpd, gpl);
-
+
/* return layer */
return gpl;
}
@@ -625,18 +625,18 @@ bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, const ch
bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
{
bGPdata *gpd;
-
+
/* allocate memory for a new block */
gpd = BKE_libblock_alloc(bmain, ID_GD, name, 0);
-
+
/* initial settings */
gpd->flag = (GP_DATA_DISPINFO | GP_DATA_EXPAND);
-
+
/* for now, stick to view is also enabled by default
* since this is more useful...
*/
gpd->flag |= GP_DATA_VIEWALIGN;
-
+
return gpd;
}
@@ -647,16 +647,16 @@ bGPDframe *BKE_gpencil_frame_duplicate(const bGPDframe *gpf_src)
{
bGPDstroke *gps_dst;
bGPDframe *gpf_dst;
-
+
/* error checking */
if (gpf_src == NULL) {
return NULL;
}
-
+
/* make a copy of the source frame */
gpf_dst = MEM_dupallocN(gpf_src);
gpf_dst->prev = gpf_dst->next = NULL;
-
+
/* copy strokes */
BLI_listbase_clear(&gpf_dst->strokes);
for (bGPDstroke *gps_src = gpf_src->strokes.first; gps_src; gps_src = gps_src->next) {
@@ -667,7 +667,7 @@ bGPDframe *BKE_gpencil_frame_duplicate(const bGPDframe *gpf_src)
gps_dst->flag |= GP_STROKE_RECALC_CACHES;
BLI_addtail(&gpf_dst->strokes, gps_dst);
}
-
+
/* return new frame */
return gpf_dst;
}
@@ -727,28 +727,28 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
const bGPDframe *gpf_src;
bGPDframe *gpf_dst;
bGPDlayer *gpl_dst;
-
+
/* error checking */
if (gpl_src == NULL) {
return NULL;
}
-
+
/* make a copy of source layer */
gpl_dst = MEM_dupallocN(gpl_src);
gpl_dst->prev = gpl_dst->next = NULL;
-
+
/* copy frames */
BLI_listbase_clear(&gpl_dst->frames);
for (gpf_src = gpl_src->frames.first; gpf_src; gpf_src = gpf_src->next) {
/* make a copy of source frame */
gpf_dst = BKE_gpencil_frame_duplicate(gpf_src);
BLI_addtail(&gpl_dst->frames, gpf_dst);
-
+
/* if source frame was the current layer's 'active' frame, reassign that too */
if (gpf_src == gpl_dst->actframe)
gpl_dst->actframe = gpf_dst;
}
-
+
/* return new layer */
return gpl_dst;
}
@@ -824,16 +824,16 @@ void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps)
{
bGPDspoint *pt;
int i;
-
+
/* error checking */
if (gps == NULL)
return;
-
+
/* we'll stop when we find the first selected point,
* so initially, we must deselect
*/
gps->flag &= ~GP_STROKE_SELECT;
-
+
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
if (pt->flag & GP_SPOINT_SELECT) {
gps->flag |= GP_STROKE_SELECT;
@@ -849,16 +849,16 @@ void BKE_gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
{
bGPDstroke *gps = (gpf) ? gpf->strokes.last : NULL;
int cfra = (gpf) ? gpf->framenum : 0; /* assume that the current frame was not locked */
-
+
/* error checking */
if (ELEM(NULL, gpf, gps))
return;
-
+
/* free the stroke and its data */
MEM_freeN(gps->points);
MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
-
+
/* if frame has no strokes after this, delete it */
if (BLI_listbase_is_empty(&gpf->strokes)) {
BKE_gpencil_layer_delframe(gpl, gpf);
@@ -874,7 +874,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl)
/* Sanity check */
if (gpl == NULL)
return false;
-
+
/* Layer must be: Visible + Editable */
if ((gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) == 0) {
/* Opacity must be sufficiently high that it is still "visible"
@@ -884,7 +884,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl)
return true;
}
}
-
+
/* Something failed */
return false;
}
@@ -893,7 +893,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl)
bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe)
{
bGPDframe *gpf;
-
+
/* Search in reverse order, since this is often used for playback/adding,
* where it's less likely that we're interested in the earlier frames
*/
@@ -902,7 +902,7 @@ bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe)
return gpf;
}
}
-
+
return NULL;
}
@@ -914,23 +914,23 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
{
bGPDframe *gpf = NULL;
short found = 0;
-
+
/* error checking */
if (gpl == NULL) return NULL;
-
+
/* check if there is already an active frame */
if (gpl->actframe) {
gpf = gpl->actframe;
-
+
/* do not allow any changes to layer's active frame if layer is locked from changes
* or if the layer has been set to stay on the current frame
*/
if (gpl->flag & GP_LAYER_FRAMELOCK)
return gpf;
/* do not allow any changes to actframe if frame has painting tag attached to it */
- if (gpf->flag & GP_FRAME_PAINT)
+ if (gpf->flag & GP_FRAME_PAINT)
return gpf;
-
+
/* try to find matching frame */
if (gpf->framenum < cframe) {
for (; gpf; gpf = gpf->next) {
@@ -943,7 +943,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
break;
}
}
-
+
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
@@ -965,7 +965,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
break;
}
}
-
+
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
@@ -985,7 +985,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
/* check which of the ends to start checking from */
const int first = ((bGPDframe *)(gpl->frames.first))->framenum;
const int last = ((bGPDframe *)(gpl->frames.last))->framenum;
-
+
if (abs(cframe - first) > abs(cframe - last)) {
/* find gp-frame which is less than or equal to cframe */
for (gpf = gpl->frames.last; gpf; gpf = gpf->prev) {
@@ -1004,7 +1004,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
}
}
}
-
+
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
@@ -1029,7 +1029,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
/* gpl->actframe should still be NULL */
}
}
-
+
/* return */
return gpl->actframe;
}
@@ -1038,23 +1038,23 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
bool BKE_gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
{
bool changed = false;
-
+
/* error checking */
if (ELEM(NULL, gpl, gpf))
return false;
-
- /* if this frame was active, make the previous frame active instead
+
+ /* if this frame was active, make the previous frame active instead
* since it's tricky to set active frame otherwise
*/
if (gpl->actframe == gpf)
gpl->actframe = gpf->prev;
else
gpl->actframe = NULL;
-
+
/* free the frame and its data */
changed = BKE_gpencil_free_strokes(gpf);
BLI_freelinkN(&gpl->frames, gpf);
-
+
return changed;
}
@@ -1062,17 +1062,17 @@ bool BKE_gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd)
{
bGPDlayer *gpl;
-
+
/* error checking */
if (ELEM(NULL, gpd, gpd->layers.first))
return NULL;
-
+
/* loop over layers until found (assume only one active) */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if (gpl->flag & GP_LAYER_ACTIVE)
return gpl;
}
-
+
/* no active layer found */
return NULL;
}
@@ -1081,15 +1081,15 @@ bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd)
void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
{
bGPDlayer *gpl;
-
+
/* error checking */
if (ELEM(NULL, gpd, gpd->layers.first, active))
return;
-
+
/* loop over layers deactivating all */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next)
gpl->flag &= ~GP_LAYER_ACTIVE;
-
+
/* set as active one */
active->flag |= GP_LAYER_ACTIVE;
}
@@ -1098,9 +1098,9 @@ void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
{
/* error checking */
- if (ELEM(NULL, gpd, gpl))
+ if (ELEM(NULL, gpd, gpl))
return;
-
+
/* free layer */
BKE_gpencil_free_frames(gpl);
BLI_freelinkN(&gpd->layers, gpl);
@@ -1281,11 +1281,11 @@ void BKE_gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char
bGPDlayer *gpl;
bGPDframe *gpf;
bGPDstroke *gps;
-
+
/* Sanity checks (gpd may not be set in the RNA pointers sometimes) */
if (ELEM(NULL, gpd, oldname, newname))
return;
-
+
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (gps = gpf->strokes.first; gps; gps = gps->next) {
@@ -1295,7 +1295,7 @@ void BKE_gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char
}
}
}
-
+
}
/* Delete all strokes of the color */
@@ -1304,11 +1304,11 @@ void BKE_gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name)
bGPDlayer *gpl;
bGPDframe *gpf;
bGPDstroke *gps, *gpsn;
-
+
/* Sanity checks (gpd may not be set in the RNA pointers sometimes) */
if (ELEM(NULL, gpd, name))
return;
-
+
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (gps = gpf->strokes.first; gps; gps = gpsn) {
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index f268c419e2f..62f608f8565 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -78,7 +78,7 @@ void BKE_group_free(Group *group)
Group *BKE_group_add(Main *bmain, const char *name)
{
Group *group;
-
+
group = BKE_libblock_alloc(bmain, ID_GR, name, 0);
id_us_min(&group->id);
id_us_ensure_real(&group->id);
@@ -126,22 +126,22 @@ void BKE_group_make_local(Main *bmain, Group *group, const bool lib_local)
static bool group_object_add_internal(Group *group, Object *ob)
{
GroupObject *go;
-
+
if (group == NULL || ob == NULL) {
return false;
}
-
+
/* check if the object has been added already */
if (BLI_findptr(&group->gobject, ob, offsetof(GroupObject, ob))) {
return false;
}
-
+
go = MEM_callocN(sizeof(GroupObject), "groupobject");
BLI_addtail(&group->gobject, go);
-
+
go->ob = ob;
id_us_ensure_real(&go->ob->id);
-
+
return true;
}
@@ -171,7 +171,7 @@ static int group_object_unlink_internal(Group *group, Object *ob)
GroupObject *go, *gon;
int removed = 0;
if (group == NULL) return 0;
-
+
go = group->gobject.first;
while (go) {
gon = go->next;
@@ -259,7 +259,7 @@ Group *BKE_group_object_find(Main *bmain, Group *group, Object *ob)
group = group->id.next;
else
group = bmain->group.first;
-
+
while (group) {
if (BKE_group_object_exists(group, ob))
return group;
@@ -293,9 +293,9 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
static bAction *action = NULL;
static bool done = false;
bActionStrip *strip, *nstrip;
-
+
if (mode == 's') {
-
+
for (strip = parent->nlastrips.first; strip; strip = strip->next) {
if (strip->object == target) {
if (done == 0) {
@@ -317,7 +317,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
BLI_freelistN(&target->nlastrips);
target->nlastrips = nlastrips;
target->action = action;
-
+
BLI_listbase_clear(&nlastrips); /* not needed, but yah... :) */
action = NULL;
done = false;
@@ -334,7 +334,7 @@ void BKE_group_handle_recalc_and_update(
Main *bmain, EvaluationContext *eval_ctx, Scene *scene, Object *UNUSED(parent), Group *group)
{
GroupObject *go;
-
+
#if 0 /* warning, isn't clearing the recalc flag on the object which causes it to run all the time,
* not just on frame change.
* This isn't working because the animation data is only re-evaluated on frame change so commenting for now
@@ -343,24 +343,24 @@ void BKE_group_handle_recalc_and_update(
/* if animated group... */
if (parent->nlastrips.first) {
int cfrao;
-
+
/* switch to local time */
cfrao = scene->r.cfra;
-
+
/* we need a DAG per group... */
for (go = group->gobject.first; go; go = go->next) {
if (go->ob && go->recalc) {
go->ob->recalc = go->recalc;
-
+
group_replaces_nla(parent, go->ob, 's');
BKE_object_handle_update(eval_ctx, scene, go->ob);
group_replaces_nla(parent, go->ob, 'e');
-
+
/* leave recalc tags in case group members are in normal scene */
go->ob->recalc = go->recalc;
}
}
-
+
/* restore */
scene->r.cfra = cfrao;
}
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 9483543f1f0..071c10acaa5 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -105,7 +105,7 @@ static int get_next_free_id(void)
/* if we haven't used up the int number range, we just return the next int */
if (gNextIconId >= gFirstIconId)
return gNextIconId++;
-
+
/* now we try to find the smallest icon id not stored in the gIcons hash */
while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId)
startId++;
@@ -203,7 +203,7 @@ void BKE_previewimg_freefunc(void *link)
if (prv->gputexture[i])
GPU_texture_free(prv->gputexture[i]);
}
-
+
MEM_freeN(prv);
}
}
@@ -468,11 +468,11 @@ void BKE_icon_changed(const int icon_id)
BLI_assert(BLI_thread_is_main());
Icon *icon = NULL;
-
+
if (!icon_id || G.background) return;
icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
-
+
if (icon) {
/* We *only* expect ID-tied icons here, not non-ID icon/preview! */
BLI_assert(icon->id_type != 0);
@@ -599,7 +599,7 @@ Icon *BKE_icon_get(const int icon_id)
Icon *icon = NULL;
icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
-
+
if (!icon) {
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
return NULL;
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 70d037d85f3..d995dce1259 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -47,7 +47,7 @@ typedef struct {
const char *name, *plural;
const char *i18n_context;
-
+
int flags;
#define IDTYPE_FLAGS_ISLINKABLE (1 << 0)
} IDType;
@@ -99,7 +99,7 @@ static IDType idtypes[] = {
/* -1 for ID_ID */
BLI_STATIC_ASSERT((ARRAY_SIZE(idtypes) - 1 == MAX_LIBARRAY), "Missing IDType");
-static IDType *idtype_from_name(const char *str)
+static IDType *idtype_from_name(const char *str)
{
int i = ARRAY_SIZE(idtypes);
@@ -118,7 +118,7 @@ static IDType *idtype_from_code(short idcode)
while (i--)
if (idcode == idtypes[i].code)
return &idtypes[i];
-
+
return NULL;
}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index fe00d68b4ea..1ce4044464e 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -86,7 +86,7 @@ IDProperty *IDP_NewIDPArray(const char *name)
prop->type = IDP_IDPARRAY;
prop->len = 0;
BLI_strncpy(prop->name, name, MAX_IDPROP_NAME);
-
+
return prop;
}
@@ -113,14 +113,14 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag)
memcpy(GETPROP(narray, i), tmp, sizeof(IDProperty));
MEM_freeN(tmp);
}
-
+
return narray;
}
static void IDP_FreeIDPArray(IDProperty *prop, const bool do_id_user)
{
int i;
-
+
BLI_assert(prop->type == IDP_IDPARRAY);
for (i = 0; i < prop->len; i++)
@@ -472,7 +472,7 @@ static IDProperty *IDP_CopyID(const IDProperty *prop, const int flag)
static IDProperty *IDP_CopyGroup(const IDProperty *prop, const int flag)
{
IDProperty *newp, *link;
-
+
BLI_assert(prop->type == IDP_GROUP);
newp = idp_generic_copy(prop, flag);
newp->len = prop->len;
@@ -1024,7 +1024,7 @@ IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *
prop->type = type;
BLI_strncpy(prop->name, name, MAX_IDPROP_NAME);
-
+
return prop;
}
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 611c1e3bafb..52a7ed5cd7e 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -37,7 +37,7 @@
*
* -- Joshua Leung, Jan 2009
*/
-
+
#include <math.h>
#include <stdio.h>
#include <string.h>
@@ -93,18 +93,18 @@ void BKE_ipo_free(Ipo *ipo)
{
IpoCurve *icu, *icn;
int n = 0;
-
+
for (icu = ipo->curve.first; icu; icu = icn) {
icn = icu->next;
n++;
-
+
if (icu->bezt) MEM_freeN(icu->bezt);
if (icu->bp) MEM_freeN(icu->bp);
if (icu->driver) MEM_freeN(icu->driver);
-
+
BLI_freelinkN(&ipo->curve, icu);
}
-
+
if (G.debug & G_DEBUG)
printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->id.name + 2);
}
@@ -177,7 +177,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *to
RET_ABP(ma_mode_bits);
}
// XXX TODO: add other types...
-
+
/* Normal curve */
return NULL;
}
@@ -191,7 +191,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case OB_LOC_X:
@@ -206,7 +206,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index)
*array_index = 1; return "delta_location";
case OB_DLOC_Z:
*array_index = 2; return "delta_location";
-
+
case OB_ROT_X:
*array_index = 0; return "rotation_euler";
case OB_ROT_Y:
@@ -219,7 +219,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index)
*array_index = 1; return "delta_rotation_euler";
case OB_DROT_Z:
*array_index = 2; return "delta_rotation_euler";
-
+
case OB_SIZE_X:
*array_index = 0; return "scale";
case OB_SIZE_Y:
@@ -261,18 +261,18 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index)
break;
#endif
}
-
+
return NULL;
}
-/* PoseChannel types
+/* PoseChannel types
* NOTE: pchan name comes from 'actname' added earlier...
*/
static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case AC_QUAT_W:
@@ -283,21 +283,21 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index)
*array_index = 2; return "rotation_quaternion";
case AC_QUAT_Z:
*array_index = 3; return "rotation_quaternion";
-
+
case AC_EUL_X:
*array_index = 0; return "rotation_euler";
case AC_EUL_Y:
*array_index = 1; return "rotation_euler";
case AC_EUL_Z:
*array_index = 2; return "rotation_euler";
-
+
case AC_LOC_X:
*array_index = 0; return "location";
case AC_LOC_Y:
*array_index = 1; return "location";
case AC_LOC_Z:
*array_index = 2; return "location";
-
+
case AC_SIZE_X:
*array_index = 0; return "scale";
case AC_SIZE_Y:
@@ -305,7 +305,7 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index)
case AC_SIZE_Z:
*array_index = 2; return "scale";
}
-
+
/* for debugging only */
printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode);
return NULL;
@@ -316,7 +316,7 @@ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case CO_ENFORCE:
@@ -324,18 +324,18 @@ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index)
case CO_HEADTAIL: // XXX this needs to be wrapped in RNA.. probably then this path will be invalid
return "data.head_tail";
}
-
+
return NULL;
}
-/* ShapeKey types
+/* ShapeKey types
* NOTE: as we don't have access to the keyblock where the data comes from (for now),
* we'll just use numerical indices for now...
*/
static char *shapekey_adrcodes_to_paths(ID *id, int adrcode, int *UNUSED(array_index))
{
static char buf[128];
-
+
/* block will be attached to ID_KE block... */
if (adrcode == 0) {
/* adrcode=0 was the misnamed "speed" curve (now "evaluation time") */
@@ -345,7 +345,7 @@ static char *shapekey_adrcodes_to_paths(ID *id, int adrcode, int *UNUSED(array_i
/* Find the name of the ShapeKey (i.e. KeyBlock) to look for */
Key *key = (Key *)id;
KeyBlock *kb = BKE_keyblock_from_key(key, adrcode);
-
+
/* setting that we alter is the "value" (i.e. keyblock.curval) */
if (kb) {
/* Use the keyblock name, escaped, so that path lookups for this will work */
@@ -364,7 +364,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
{
const char *base = NULL, *prop = NULL;
static char buf[128];
-
+
/* base part of path */
if (adrcode & MA_MAP1) base = "textures[0]";
else if (adrcode & MA_MAP2) base = "textures[1]";
@@ -384,7 +384,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
else if (adrcode & MA_MAP16) base = "textures[15]";
else if (adrcode & MA_MAP17) base = "textures[16]";
else if (adrcode & MA_MAP18) base = "textures[17]";
-
+
/* property identifier for path */
adrcode = (adrcode & (MA_MAP1 - 1));
switch (adrcode) {
@@ -419,7 +419,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
case MAP_DISP:
prop = "warp_factor"; break;
}
-
+
/* only build and return path if there's a property */
if (prop) {
BLI_snprintf(buf, 128, "%s.%s", base, prop);
@@ -434,26 +434,26 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case TE_NSIZE:
return "noise_size";
case TE_TURB:
return "turbulence";
-
+
case TE_NDEPTH: // XXX texture RNA undefined
//poin= &(tex->noisedepth); *type= IPO_SHORT; break;
break;
case TE_NTYPE: // XXX texture RNA undefined
//poin= &(tex->noisetype); *type= IPO_SHORT; break;
break;
-
+
case TE_N_BAS1:
return "noise_basis";
case TE_N_BAS2:
return "noise_basis"; // XXX this is not yet defined in RNA...
-
+
/* voronoi */
case TE_VNW1:
*array_index = 0; return "feature_weights";
@@ -469,15 +469,15 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index)
return "distance_metric";
case TE_VN_COLT:
return "color_type";
-
+
/* distorted noise / voronoi */
case TE_ISCA:
return "noise_intensity";
-
+
/* distorted noise */
case TE_DISTA:
return "distortion_amount";
-
+
/* musgrave */
case TE_MG_TYP: // XXX texture RNA undefined
// poin= &(tex->stype); *type= IPO_SHORT; break;
@@ -492,20 +492,20 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index)
return "offset";
case TE_MG_GAIN:
return "gain";
-
+
case TE_COL_R:
*array_index = 0; return "rgb_factor";
case TE_COL_G:
*array_index = 1; return "rgb_factor";
case TE_COL_B:
*array_index = 2; return "rgb_factor";
-
+
case TE_BRIGHT:
return "brightness";
case TE_CONTRA:
return "constrast";
}
-
+
return NULL;
}
@@ -514,7 +514,7 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case MA_COL_R:
@@ -523,73 +523,73 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index)
*array_index = 1; return "diffuse_color";
case MA_COL_B:
*array_index = 2; return "diffuse_color";
-
+
case MA_SPEC_R:
*array_index = 0; return "specular_color";
case MA_SPEC_G:
*array_index = 1; return "specular_color";
case MA_SPEC_B:
*array_index = 2; return "specular_color";
-
+
case MA_MIR_R:
*array_index = 0; return "mirror_color";
case MA_MIR_G:
*array_index = 1; return "mirror_color";
case MA_MIR_B:
*array_index = 2; return "mirror_color";
-
+
case MA_ALPHA:
return "alpha";
-
+
case MA_REF:
return "diffuse_intensity";
-
+
case MA_EMIT:
return "emit";
-
+
case MA_AMB:
return "ambient";
-
+
case MA_SPEC:
return "specular_intensity";
-
+
case MA_HARD:
return "specular_hardness";
-
+
case MA_SPTR:
return "specular_opacity";
-
+
case MA_IOR:
return "ior";
-
+
case MA_HASIZE:
return "halo.size";
-
+
case MA_TRANSLU:
return "translucency";
-
+
case MA_RAYM:
return "raytrace_mirror.reflect";
-
+
case MA_FRESMIR:
return "raytrace_mirror.fresnel";
-
+
case MA_FRESMIRI:
return "raytrace_mirror.fresnel_factor";
-
+
case MA_FRESTRA:
return "raytrace_transparency.fresnel";
-
+
case MA_FRESTRAI:
return "raytrace_transparency.fresnel_factor";
-
+
case MA_ADD:
return "halo.add";
-
+
default: /* for now, we assume that the others were MTex channels */
return mtex_adrcodes_to_paths(adrcode, array_index);
}
-
+
return NULL;
}
@@ -598,7 +598,7 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case CAM_LENS:
@@ -606,29 +606,29 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
if (ca->type == CAM_ORTHO)
return "ortho_scale";
else
- return "lens";
+ return "lens";
#else // XXX lazy hack for now...
return "lens";
#endif // XXX this cannot be resolved easily
-
+
case CAM_STA:
return "clip_start";
case CAM_END:
return "clip_end";
-
+
#if 0 // XXX these are not defined in RNA
case CAM_YF_APERT:
poin = &(ca->YF_aperture); break;
case CAM_YF_FDIST:
poin = &(ca->YF_dofdist); break;
#endif // XXX these are not defined in RNA
-
+
case CAM_SHIFT_X:
return "shift_x";
case CAM_SHIFT_Y:
return "shift_y";
}
-
+
/* unrecognised adrcode, or not-yet-handled ones! */
return NULL;
}
@@ -638,39 +638,39 @@ static const char *lamp_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case LA_ENERGY:
return "energy";
-
+
case LA_COL_R:
*array_index = 0; return "color";
case LA_COL_G:
*array_index = 1; return "color";
case LA_COL_B:
*array_index = 2; return "color";
-
+
case LA_DIST:
return "distance";
-
+
case LA_SPOTSI:
return "spot_size";
case LA_SPOTBL:
return "spot_blend";
-
+
case LA_QUAD1:
return "linear_attenuation";
case LA_QUAD2:
return "quadratic_attenuation";
-
+
case LA_HALOINT:
return "halo_intensity";
-
+
default: /* for now, we assume that the others were MTex channels */
return mtex_adrcodes_to_paths(adrcode, array_index);
}
-
+
/* unrecognised adrcode, or not-yet-handled ones! */
return NULL;
}
@@ -680,7 +680,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case SND_VOLUME:
@@ -695,7 +695,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index)
case SND_ATTEN:
return "attenuation";
}
-
+
/* unrecognised adrcode, or not-yet-handled ones! */
return NULL;
}
@@ -705,7 +705,7 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case WO_HOR_R:
@@ -720,10 +720,10 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index)
*array_index = 1; return "zenith_color";
case WO_ZEN_B:
*array_index = 2; return "zenith_color";
-
+
case WO_EXPOS:
return "exposure";
-
+
case WO_MISI:
return "mist.intensity";
case WO_MISTDI:
@@ -732,11 +732,11 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index)
return "mist.start";
case WO_MISTHI:
return "mist.height";
-
+
default: /* for now, we assume that the others were MTex channels */
return mtex_adrcodes_to_paths(adrcode, array_index);
}
-
+
return NULL;
}
@@ -745,7 +745,7 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
-
+
/* result depends on adrcode */
switch (adrcode) {
case PART_CLUMP:
@@ -776,7 +776,7 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index)
return "settings.kink_shape";
case PART_BB_TILT:
return "settings.billboard_tilt";
-
+
/* PartDeflect needs to be sorted out properly in rna_object_force;
* If anyone else works on this, but is unfamiliar, these particular
* settings reference the particles of the system themselves
@@ -826,64 +826,64 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
char *rpath = NULL;
char buf[512];
int dummy_index = 0;
-
+
/* hack: if constname is set, we can only be dealing with an Constraint curve */
if (constname)
blocktype = ID_CO;
-
+
/* get property name based on blocktype */
switch (blocktype) {
case ID_OB: /* object */
propname = ob_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_PO: /* pose channel */
propname = pchan_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_KE: /* shapekeys */
propname = shapekey_adrcodes_to_paths(id, adrcode, &dummy_index);
break;
-
+
case ID_CO: /* constraint */
propname = constraint_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_TE: /* texture */
propname = texture_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_MA: /* material */
propname = material_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_CA: /* camera */
propname = camera_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_LA: /* lamp */
propname = lamp_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_SO: /* sound */
propname = sound_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_WO: /* world */
propname = world_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_PA: /* particle */
propname = particle_adrcodes_to_paths(adrcode, &dummy_index);
break;
-
+
case ID_CU: /* curve */
- /* this used to be a 'dummy' curve which got evaluated on the fly...
+ /* this used to be a 'dummy' curve which got evaluated on the fly...
* now we've got real var for this!
*/
propname = "eval_time";
break;
-
+
/* XXX problematic blocktypes */
case ID_SEQ: /* sequencer strip */
//SEQ_FAC1:
@@ -900,28 +900,28 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
}
// poin= &(seq->facf0); // XXX this doesn't seem to be included anywhere in sequencer RNA...
break;
-
+
/* special hacks */
case -1:
/* special case for rotdiff drivers... we don't need a property for this... */
break;
-
+
/* TODO... add other blocktypes... */
default:
printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode);
break;
}
-
- /* check if any property found
+
+ /* check if any property found
* - blocktype < 0 is special case for a specific type of driver, where we don't need a property name...
*/
if ((propname == NULL) && (blocktype > 0)) {
/* nothing was found, so exit */
- if (array_index)
+ if (array_index)
*array_index = 0;
-
+
BLI_dynstr_free(path);
-
+
return NULL;
}
else {
@@ -963,24 +963,24 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
}
BLI_dynstr_append(path, buf);
-
+
/* need to add dot before property if there was anything precceding this */
if (buf[0])
BLI_dynstr_append(path, ".");
-
+
/* now write name of property */
BLI_dynstr_append(path, propname);
-
+
/* if there was no array index pointer provided, add it to the path */
if (array_index == NULL) {
BLI_snprintf(buf, sizeof(buf), "[\"%d\"]", dummy_index);
BLI_dynstr_append(path, buf);
}
-
+
/* convert to normal MEM_malloc'd string */
rpath = BLI_dynstr_get_cstring(path);
BLI_dynstr_free(path);
-
+
/* return path... */
return rpath;
}
@@ -998,21 +998,21 @@ static short adrcode_to_dtar_transchan(short adrcode)
return DTAR_TRANSCHAN_LOCY;
case OB_LOC_Z:
return DTAR_TRANSCHAN_LOCZ;
-
+
case OB_ROT_X:
return DTAR_TRANSCHAN_ROTX;
case OB_ROT_Y:
return DTAR_TRANSCHAN_ROTY;
case OB_ROT_Z:
return DTAR_TRANSCHAN_ROTZ;
-
+
case OB_SIZE_X:
return DTAR_TRANSCHAN_SCALEX;
case OB_SIZE_Y:
return DTAR_TRANSCHAN_SCALEX;
case OB_SIZE_Z:
return DTAR_TRANSCHAN_SCALEX;
-
+
default:
return 0;
}
@@ -1022,10 +1022,10 @@ static short adrcode_to_dtar_transchan(short adrcode)
static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
{
ChannelDriver *cdriver;
-
+
/* allocate memory for new driver */
cdriver = MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
-
+
/* if 'pydriver', just copy data across */
if (idriver->type == IPO_DRIVER_TYPE_PYTHON) {
/* PyDriver only requires the expression to be copied */
@@ -1037,24 +1037,24 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
else {
DriverVar *dvar = NULL;
DriverTarget *dtar = NULL;
-
+
/* this should be ok for all types here... */
cdriver->type = DRIVER_TYPE_AVERAGE;
-
+
/* what to store depends on the 'blocktype' - object or posechannel */
if (idriver->blocktype == ID_AR) { /* PoseChannel */
if (idriver->adrcode == OB_ROT_DIFF) {
/* Rotational Difference requires a special type of variable */
dvar = driver_add_new_variable(cdriver);
driver_change_variable_type(dvar, DVAR_TYPE_ROT_DIFF);
-
+
/* first bone target */
dtar = &dvar->targets[0];
dtar->id = (ID *)idriver->ob;
dtar->idtype = ID_OB;
if (idriver->name[0])
BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
-
+
/* second bone target (name was stored in same var as the first one) */
dtar = &dvar->targets[1];
dtar->id = (ID *)idriver->ob;
@@ -1066,7 +1066,7 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
/* only a single variable, of type 'transform channel' */
dvar = driver_add_new_variable(cdriver);
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
-
+
/* only requires a single target */
dtar = &dvar->targets[0];
dtar->id = (ID *)idriver->ob;
@@ -1081,7 +1081,7 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
/* only a single variable, of type 'transform channel' */
dvar = driver_add_new_variable(cdriver);
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
-
+
/* only requires single target */
dtar = &dvar->targets[0];
dtar->id = (ID *)idriver->ob;
@@ -1089,12 +1089,12 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
dtar->transChan = adrcode_to_dtar_transchan(idriver->adrcode);
}
}
-
+
/* return the new one */
return cdriver;
}
-/* Add F-Curve to the correct list
+/* Add F-Curve to the correct list
* - grpname is needed to be used as group name where relevant, and is usually derived from actname
*/
static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
@@ -1106,7 +1106,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch
*/
bAction tmp_act;
bActionGroup *agrp = NULL;
-
+
/* init the temp action */
memset(&tmp_act, 0, sizeof(bAction)); // XXX only enable this line if we get errors
tmp_act.groups.first = groups->first;
@@ -1114,7 +1114,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch
tmp_act.curves.first = list->first;
tmp_act.curves.last = list->last;
/* ... xxx, the other vars don't need to be filled in */
-
+
/* get the group to use */
agrp = BKE_action_group_find_name(&tmp_act, grpname);
/* no matching group, so add one */
@@ -1131,14 +1131,14 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch
BLI_uniquename(&tmp_act.groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name),
sizeof(agrp->name));
}
-
+
/* add F-Curve to group */
/* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */
action_groups_add_channel(&tmp_act, agrp, fcu);
-
+
if (agrp->flag & AGRP_MUTED) /* flush down */
fcu->flag |= FCURVE_MUTED;
-
+
/* set the output lists based on the ones in the temp action */
groups->first = tmp_act.groups.first;
groups->last = tmp_act.groups.last;
@@ -1151,7 +1151,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch
}
}
-/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that
+/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that
* is not relevant, BUT do not free the IPO-Curve itself...
* actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
* constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
@@ -1162,21 +1162,21 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
AdrBit2Path *abp;
FCurve *fcu;
int totbits;
-
+
/* allocate memory for a new F-Curve */
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
-
+
/* convert driver */
if (icu->driver)
fcu->driver = idriver_to_cdriver(icu->driver);
-
+
/* copy flags */
if (icu->flag & IPO_VISIBLE) fcu->flag |= FCURVE_VISIBLE;
if (icu->flag & IPO_SELECT) fcu->flag |= FCURVE_SELECTED;
if (icu->flag & IPO_ACTIVE) fcu->flag |= FCURVE_ACTIVE;
if (icu->flag & IPO_MUTE) fcu->flag |= FCURVE_MUTED;
if (icu->flag & IPO_PROTECT) fcu->flag |= FCURVE_PROTECTED;
-
+
/* set extrapolation */
switch (icu->extrap) {
case IPO_HORIZ: /* constant extrapolation */
@@ -1189,12 +1189,12 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
case IPO_CYCL: /* cyclic extrapolation */
case IPO_CYCLX: /* cyclic extrapolation + offset */
{
- /* Add a new FModifier (Cyclic) instead of setting extend value
+ /* Add a new FModifier (Cyclic) instead of setting extend value
* as that's the new equivalent of that option.
*/
FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu);
FMod_Cycles *data = (FMod_Cycles *)fcm->data;
-
+
/* if 'offset' one is in use, set appropriate settings */
if (icu->extrap == IPO_CYCLX)
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC_OFFSET;
@@ -1203,20 +1203,20 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
break;
}
}
-
+
/* -------- */
-
+
/* get adrcode <-> bitflags mapping to handle nasty bitflag curves? */
abp = adrcode_bitmaps_to_paths(icu->blocktype, icu->adrcode, &totbits);
if (abp && totbits) {
FCurve *fcurve;
int b;
-
+
if (G.debug & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d\n", totbits);
-
+
/* add the 'only int values' flag */
fcu->flag |= (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES);
-
+
/* for each bit we have to remap + check for:
* 1) we need to make copy the existing F-Curve data (fcu -> fcurve),
* except for the last one which will use the original
@@ -1225,46 +1225,46 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
*/
for (b = 0; b < totbits; b++, abp++) {
unsigned int i = 0;
-
+
/* make a copy of existing base-data if not the last curve */
if (b < (totbits - 1))
fcurve = copy_fcurve(fcu);
else
fcurve = fcu;
-
+
/* set path */
fcurve->rna_path = BLI_strdup(abp->path);
fcurve->array_index = abp->array_index;
-
- /* convert keyframes
+
+ /* convert keyframes
* - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
* - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
*/
fcurve->totvert = icu->totvert;
-
+
if (icu->bezt) {
BezTriple *dst, *src;
-
+
/* allocate new array for keyframes/beztriples */
fcurve->bezt = MEM_callocN(sizeof(BezTriple) * fcurve->totvert, "BezTriples");
-
+
/* loop through copying all BezTriples individually, as we need to modify a few things */
for (dst = fcurve->bezt, src = icu->bezt, i = 0; i < fcurve->totvert; i++, dst++, src++) {
/* firstly, copy BezTriple data */
*dst = *src;
-
+
/* interpolation can only be constant... */
dst->ipo = BEZT_IPO_CONST;
-
+
/* 'hide' flag is now used for keytype - only 'keyframes' existed before */
dst->hide = BEZT_KEYTYPE_KEYFRAME;
-
+
/* auto-handles - per curve to per handle */
if (icu->flag & IPO_AUTO_HORIZ) {
if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM;
if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM;
}
-
+
/* correct values, by checking if the flag of interest is set */
if ( ((int)(dst->vec[1][1])) & (abp->bit) )
dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 1.0f;
@@ -1277,80 +1277,80 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
//BPoint *bp;
//FPoint *fpt;
}
-
+
/* add new F-Curve to list */
fcurve_add_to_list(groups, list, fcurve, actname, muteipo);
}
}
else {
unsigned int i = 0;
-
+
/* get rna-path
* - we will need to set the 'disabled' flag if no path is able to be made (for now)
*/
fcu->rna_path = get_rna_access(id, icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index);
if (fcu->rna_path == NULL)
fcu->flag |= FCURVE_DISABLED;
-
- /* convert keyframes
+
+ /* convert keyframes
* - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
* - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
*/
fcu->totvert = icu->totvert;
-
+
if (icu->bezt) {
BezTriple *dst, *src;
-
+
/* allocate new array for keyframes/beztriples */
fcu->bezt = MEM_callocN(sizeof(BezTriple) * fcu->totvert, "BezTriples");
-
+
/* loop through copying all BezTriples individually, as we need to modify a few things */
for (dst = fcu->bezt, src = icu->bezt, i = 0; i < fcu->totvert; i++, dst++, src++) {
/* firstly, copy BezTriple data */
*dst = *src;
-
+
/* now copy interpolation from curve (if not already set) */
if (icu->ipo != IPO_MIXED)
dst->ipo = icu->ipo;
-
+
/* 'hide' flag is now used for keytype - only 'keyframes' existed before */
dst->hide = BEZT_KEYTYPE_KEYFRAME;
-
+
/* auto-handles - per curve to per handle */
if (icu->flag & IPO_AUTO_HORIZ) {
if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM;
if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM;
}
-
- /* correct values for euler rotation curves
- * - they were degrees/10
+
+ /* correct values for euler rotation curves
+ * - they were degrees/10
* - we need radians for RNA to do the right thing
*/
if ( ((icu->blocktype == ID_OB) && ELEM(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) ||
((icu->blocktype == ID_PO) && ELEM(icu->adrcode, AC_EUL_X, AC_EUL_Y, AC_EUL_Z)) )
{
const float fac = (float)M_PI / 18.0f; //10.0f * M_PI/180.0f;
-
+
dst->vec[0][1] *= fac;
dst->vec[1][1] *= fac;
dst->vec[2][1] *= fac;
}
-
- /* correct values for path speed curves
+
+ /* correct values for path speed curves
* - their values were 0-1
* - we now need as 'frames'
*/
- if ( (id) && (icu->blocktype == GS(id->name)) &&
+ if ( (id) && (icu->blocktype == GS(id->name)) &&
(fcu->rna_path && STREQ(fcu->rna_path, "eval_time")) )
{
Curve *cu = (Curve *)id;
-
+
dst->vec[0][1] *= cu->pathlen;
dst->vec[1][1] *= cu->pathlen;
dst->vec[2][1] *= cu->pathlen;
}
-
- /* correct times for rotation drivers
+
+ /* correct times for rotation drivers
* - need to go from degrees to radians...
* - there's only really 1 target to worry about
* - were also degrees/10
@@ -1358,27 +1358,27 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
if (fcu->driver && fcu->driver->variables.first) {
DriverVar *dvar = fcu->driver->variables.first;
DriverTarget *dtar = &dvar->targets[0];
-
+
if (ELEM(dtar->transChan, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ)) {
const float fac = (float)M_PI / 18.0f;
-
+
dst->vec[0][0] *= fac;
dst->vec[1][0] *= fac;
dst->vec[2][0] *= fac;
}
}
-
+
/* correct values for sequencer curves, that were not locked to frame */
if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
const float mul = (seq->enddisp - seq->startdisp) / 100.0f;
const float offset = seq->startdisp;
-
+
dst->vec[0][0] *= mul;
dst->vec[0][0] += offset;
-
+
dst->vec[1][0] *= mul;
dst->vec[1][0] += offset;
-
+
dst->vec[2][0] *= mul;
dst->vec[2][0] += offset;
}
@@ -1389,7 +1389,7 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
//BPoint *bp;
//FPoint *fpt;
}
-
+
/* add new F-Curve to list */
fcurve_add_to_list(groups, list, fcu, actname, muteipo);
}
@@ -1404,16 +1404,16 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq, ListBase *animgroups, ListBase *anim, ListBase *drivers)
{
IpoCurve *icu;
-
+
/* sanity check */
if (ELEM(NULL, ipo, anim, drivers))
return;
-
+
if (G.debug & G_DEBUG) printf("ipo_to_animato\n");
-
- /* validate actname and constname
+
+ /* validate actname and constname
* - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
- * - actname can then be used to assign F-Curves in Action to Action Groups
+ * - actname can then be used to assign F-Curves in Action to Action Groups
* (i.e. thus keeping the benefits that used to be provided by Action Channels for grouping
* F-Curves for bones). This may be added later... for now let's just dump without them...
*/
@@ -1423,10 +1423,10 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S
else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape"))
actname = NULL;
}
-
+
/* loop over IPO-Curves, freeing as we progress */
for (icu = ipo->curve.first; icu; icu = icu->next) {
- /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves),
+ /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves),
* we figure out the best place to put the channel, then tell the curve-converter to just dump there
*/
if (icu->driver) {
@@ -1442,23 +1442,23 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S
else
icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seq, ipo->muteipo);
}
-
+
/* if this IPO block doesn't have any users after this one, free... */
id_us_min(&ipo->id);
if (ID_REAL_USERS(ipo) <= 0) {
IpoCurve *icn;
-
+
for (icu = ipo->curve.first; icu; icu = icn) {
icn = icu->next;
-
+
/* free driver */
if (icu->driver)
MEM_freeN(icu->driver);
-
+
/* free old data of curve now that it's no longer needed for converting any more curves */
if (icu->bezt) MEM_freeN(icu->bezt);
if (icu->bp) MEM_freeN(icu->bezt);
-
+
/* free this IPO-Curve */
BLI_freelinkN(&ipo->curve, icu);
}
@@ -1474,44 +1474,44 @@ static void action_to_animato(ID *id, bAction *act, ListBase *groups, ListBase *
{
bActionChannel *achan, *achann;
bConstraintChannel *conchan, *conchann;
-
+
/* only continue if there are Action Channels (indicating unconverted data) */
if (BLI_listbase_is_empty(&act->chanbase))
return;
-
+
/* get rid of all Action Groups */
// XXX this is risky if there's some old + some new data in the Action...
- if (act->groups.first)
+ if (act->groups.first)
BLI_freelistN(&act->groups);
-
+
/* loop through Action-Channels, converting data, freeing as we go */
for (achan = act->chanbase.first; achan; achan = achann) {
/* get pointer to next Action Channel */
achann = achan->next;
-
+
/* convert Action Channel's IPO data */
if (achan->ipo) {
ipo_to_animato(id, achan->ipo, achan->name, NULL, NULL, groups, curves, drivers);
id_us_min(&achan->ipo->id);
achan->ipo = NULL;
}
-
+
/* convert constraint channel IPO-data */
for (conchan = achan->constraintChannels.first; conchan; conchan = conchann) {
/* get pointer to next Constraint Channel */
conchann = conchan->next;
-
+
/* convert Constraint Channel's IPO data */
if (conchan->ipo) {
ipo_to_animato(id, conchan->ipo, achan->name, conchan->name, NULL, groups, curves, drivers);
id_us_min(&conchan->ipo->id);
conchan->ipo = NULL;
}
-
+
/* free Constraint Channel */
BLI_freelinkN(&achan->constraintChannels, conchan);
}
-
+
/* free Action Channel */
BLI_freelinkN(&act->chanbase, achan);
}
@@ -1529,7 +1529,7 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char
AnimData *adt = BKE_animdata_from_id(id);
ListBase anim = {NULL, NULL};
ListBase drivers = {NULL, NULL};
-
+
/* sanity check */
if (ELEM(NULL, id, ipo))
return;
@@ -1537,36 +1537,36 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char
printf("ERROR ipo_to_animdata(): adt invalid\n");
return;
}
-
+
if (G.debug & G_DEBUG) {
printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n",
id->name + 2, ipo->id.name + 2, (actname) ? actname : "<None>", (constname) ? constname : "<None>", (seq) ? (seq->name + 2) : "<None>",
BLI_listbase_count(&ipo->curve));
}
-
+
/* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers),
* and the try to put these lists in the right places, but do not free the lists here
*/
- // XXX there shouldn't be any need for the groups, so don't supply pointer for that now...
+ // XXX there shouldn't be any need for the groups, so don't supply pointer for that now...
ipo_to_animato(id, ipo, actname, constname, seq, NULL, &anim, &drivers);
-
+
/* deal with animation first */
if (anim.first) {
if (G.debug & G_DEBUG) printf("\thas anim\n");
/* try to get action */
if (adt->action == NULL) {
char nameBuf[MAX_ID_NAME];
-
+
BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2);
-
+
adt->action = BKE_action_add(bmain, nameBuf);
if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf);
}
-
+
/* add F-Curves to action */
BLI_movelisttolist(&adt->action->curves, &anim);
}
-
+
/* deal with drivers */
if (drivers.first) {
if (G.debug & G_DEBUG) printf("\thas drivers\n");
@@ -1581,18 +1581,18 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char
static void action_to_animdata(ID *id, bAction *act)
{
AnimData *adt = BKE_animdata_from_id(id);
-
+
/* only continue if there are Action Channels (indicating unconverted data) */
if (ELEM(NULL, adt, act->chanbase.first))
return;
-
+
/* check if we need to set this Action as the AnimData's action */
if (adt->action == NULL) {
/* set this Action as AnimData's Action */
if (G.debug & G_DEBUG) printf("act_to_adt - set adt action to act\n");
adt->action = act;
}
-
+
/* convert Action data */
action_to_animato(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers);
}
@@ -1610,25 +1610,25 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
NlaTrack *nlt = NULL;
NlaStrip *strip;
bActionStrip *as, *asn;
-
+
/* for each one of the original strips, convert to a new strip and free the old... */
for (as = strips->first; as; as = asn) {
asn = as->next;
-
+
/* this old strip is only worth something if it had an action... */
if (as->act) {
/* convert Action data (if not yet converted), storing the results in the same Action */
action_to_animato(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers);
-
+
/* create a new-style NLA-strip which references this Action, then copy over relevant settings */
{
- /* init a new strip, and assign the action to it
- * - no need to muck around with the user-counts, since this is just
+ /* init a new strip, and assign the action to it
+ * - no need to muck around with the user-counts, since this is just
* passing over the ref to the new owner, not creating an additional ref
*/
strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
strip->act = as->act;
-
+
/* endpoints */
strip->start = as->start;
strip->end = as->end;
@@ -1657,25 +1657,25 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0)
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
}
-
+
/* try to add this strip to the current NLA-Track (i.e. the 'last' one on the stack atm) */
if (BKE_nlatrack_add_strip(nlt, strip) == 0) {
- /* trying to add to the current failed (no space),
+ /* trying to add to the current failed (no space),
* so add a new track to the stack, and add to that...
*/
nlt = BKE_nlatrack_add(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
-
+
/* ensure that strip has a name */
BKE_nlastrip_validate_name(adt, strip);
}
-
+
/* modifiers */
// FIXME: for now, we just free them...
if (as->modifiers.first)
BLI_freelistN(&as->modifiers);
-
+
/* free the old strip */
BLI_freelinkN(strips, as);
}
@@ -1694,17 +1694,17 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
* Data that has been converted should be freed immediately, which means that it is immediately
* clear which datablocks have yet to be converted, and also prevent freeing errors when we exit.
*/
-// XXX currently done after all file reading...
+// XXX currently done after all file reading...
void do_versions_ipos_to_animato(Main *bmain)
{
ListBase drivers = {NULL, NULL};
ID *id;
-
+
if (bmain == NULL) {
printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n");
return;
}
-
+
/* only convert if version is right */
if (bmain->versionfile >= 250) {
printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile);
@@ -1712,57 +1712,57 @@ void do_versions_ipos_to_animato(Main *bmain)
}
else if (G.debug & G_DEBUG)
printf("INFO: Converting to Animato...\n");
-
+
/* ----------- Animation Attached to Data -------------- */
-
+
/* objects */
for (id = bmain->object.first; id; id = id->next) {
Object *ob = (Object *)id;
bPoseChannel *pchan;
bConstraint *con;
bConstraintChannel *conchan, *conchann;
-
+
if (G.debug & G_DEBUG) printf("\tconverting ob %s\n", id->name + 2);
-
+
/* check if object has any animation data */
if (ob->nlastrips.first) {
/* Add AnimData block */
BKE_animdata_add_id(id);
-
+
/* IPO first to take into any non-NLA'd Object Animation */
if (ob->ipo) {
ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL);
-
+
id_us_min(&ob->ipo->id);
ob->ipo = NULL;
}
-
- /* Action is skipped since it'll be used by some strip in the NLA anyway,
+
+ /* Action is skipped since it'll be used by some strip in the NLA anyway,
* causing errors with evaluation in the new evaluation pipeline
*/
if (ob->action) {
id_us_min(&ob->action->id);
ob->action = NULL;
}
-
+
/* finally NLA */
nlastrips_to_animdata(id, &ob->nlastrips);
}
else if ((ob->ipo) || (ob->action)) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Action first - so that Action name get conserved */
if (ob->action) {
action_to_animdata(id, ob->action);
-
+
/* only decrease usercount if this Action isn't now being used by AnimData */
if (ob->action != adt->action) {
id_us_min(&ob->action->id);
ob->action = NULL;
}
}
-
+
/* IPO second... */
if (ob->ipo) {
ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL);
@@ -1787,19 +1787,19 @@ void do_versions_ipos_to_animato(Main *bmain)
}
}
}
-
+
/* check PoseChannels for constraints with local data */
if (ob->pose) {
/* Verify if there's AnimData block */
BKE_animdata_add_id(id);
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) {
- /* if constraint has own IPO, convert add these to Object
- * (NOTE: they're most likely to be drivers too)
+ /* if constraint has own IPO, convert add these to Object
+ * (NOTE: they're most likely to be drivers too)
*/
if (con->ipo) {
- /* although this was the constraint's local IPO, we still need to provide pchan + con
+ /* although this was the constraint's local IPO, we still need to provide pchan + con
* so that drivers can be added properly...
*/
ipo_to_animdata(bmain, id, con->ipo, pchan->name, con->name, NULL);
@@ -1809,49 +1809,49 @@ void do_versions_ipos_to_animato(Main *bmain)
}
}
}
-
+
/* check constraints for local IPO's */
for (con = ob->constraints.first; con; con = con->next) {
- /* if constraint has own IPO, convert add these to Object
- * (NOTE: they're most likely to be drivers too)
+ /* if constraint has own IPO, convert add these to Object
+ * (NOTE: they're most likely to be drivers too)
*/
if (con->ipo) {
/* Verify if there's AnimData block, just in case */
BKE_animdata_add_id(id);
-
- /* although this was the constraint's local IPO, we still need to provide con
+
+ /* although this was the constraint's local IPO, we still need to provide con
* so that drivers can be added properly...
*/
ipo_to_animdata(bmain, id, con->ipo, NULL, con->name, NULL);
id_us_min(&con->ipo->id);
con->ipo = NULL;
}
-
+
/* check for Action Constraint */
// XXX do we really want to do this here?
}
-
+
/* check constraint channels - we need to remove them anyway... */
if (ob->constraintChannels.first) {
/* Verify if there's AnimData block */
BKE_animdata_add_id(id);
-
+
for (conchan = ob->constraintChannels.first; conchan; conchan = conchann) {
/* get pointer to next Constraint Channel */
conchann = conchan->next;
-
+
/* convert Constraint Channel's IPO data */
if (conchan->ipo) {
ipo_to_animdata(bmain, id, conchan->ipo, NULL, conchan->name, NULL);
id_us_min(&conchan->ipo->id);
conchan->ipo = NULL;
}
-
+
/* free Constraint Channel */
BLI_freelinkN(&ob->constraintChannels, conchan);
}
}
-
+
/* object's action will always be object-rooted */
{
AnimData *adt = BKE_animdata_from_id(id);
@@ -1859,100 +1859,100 @@ void do_versions_ipos_to_animato(Main *bmain)
adt->action->idroot = ID_OB;
}
}
-
+
/* shapekeys */
for (id = bmain->key.first; id; id = id->next) {
Key *key = (Key *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting key %s\n", id->name + 2);
-
- /* we're only interested in the IPO
+
+ /* we're only interested in the IPO
* NOTE: for later, it might be good to port these over to Object instead, as many of these
* are likely to be drivers, but it's hard to trace that from here, so move this to Ob loop?
*/
if (key->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Shapekey data... */
ipo_to_animdata(bmain, id, key->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = key->ipo->blocktype;
-
+
id_us_min(&key->ipo->id);
key->ipo = NULL;
}
}
-
+
/* materials */
for (id = bmain->mat.first; id; id = id->next) {
Material *ma = (Material *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting material %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (ma->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Material data... */
ipo_to_animdata(bmain, id, ma->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = ma->ipo->blocktype;
-
+
id_us_min(&ma->ipo->id);
ma->ipo = NULL;
}
}
-
+
/* worlds */
for (id = bmain->world.first; id; id = id->next) {
World *wo = (World *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting world %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (wo->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert World data... */
ipo_to_animdata(bmain, id, wo->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = wo->ipo->blocktype;
-
+
id_us_min(&wo->ipo->id);
wo->ipo = NULL;
}
}
-
+
/* sequence strips */
for (id = bmain->scene.first; id; id = id->next) {
Scene *scene = (Scene *)id;
Editing *ed = scene->ed;
if (ed && ed->seqbasep) {
Sequence *seq;
-
+
AnimData *adt = BKE_animdata_add_id(id);
-
+
SEQ_BEGIN(ed, seq)
{
IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
short adrcode = SEQ_FAC1;
-
+
if (G.debug & G_DEBUG)
printf("\tconverting sequence strip %s\n", seq->name + 2);
-
+
if (ELEM(NULL, seq->ipo, icu)) {
seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
continue;
}
-
+
/* patch adrcode, so that we can map
- * to different DNA variables later
+ * to different DNA variables later
* (semi-hack (tm) )
*/
switch (seq->type) {
@@ -1968,13 +1968,13 @@ void do_versions_ipos_to_animato(Main *bmain)
break;
}
icu->adrcode = adrcode;
-
+
/* convert IPO */
ipo_to_animdata(bmain, (ID *)scene, seq->ipo, NULL, NULL, seq);
-
+
if (adt->action)
adt->action->idroot = ID_SCE; /* scene-rooted */
-
+
id_us_min(&seq->ipo->id);
seq->ipo = NULL;
}
@@ -1986,140 +1986,140 @@ void do_versions_ipos_to_animato(Main *bmain)
/* textures */
for (id = bmain->tex.first; id; id = id->next) {
Tex *te = (Tex *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting texture %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (te->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Texture data... */
ipo_to_animdata(bmain, id, te->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = te->ipo->blocktype;
-
+
id_us_min(&te->ipo->id);
te->ipo = NULL;
}
}
-
+
/* cameras */
for (id = bmain->camera.first; id; id = id->next) {
Camera *ca = (Camera *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting camera %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (ca->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Camera data... */
ipo_to_animdata(bmain, id, ca->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = ca->ipo->blocktype;
-
+
id_us_min(&ca->ipo->id);
ca->ipo = NULL;
}
}
-
+
/* lamps */
for (id = bmain->lamp.first; id; id = id->next) {
Lamp *la = (Lamp *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting lamp %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (la->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Lamp data... */
ipo_to_animdata(bmain, id, la->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = la->ipo->blocktype;
-
+
id_us_min(&la->ipo->id);
la->ipo = NULL;
}
}
-
+
/* curves */
for (id = bmain->curve.first; id; id = id->next) {
Curve *cu = (Curve *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting curve %s\n", id->name + 2);
-
+
/* we're only interested in the IPO */
if (cu->ipo) {
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
-
+
/* Convert Curve data... */
ipo_to_animdata(bmain, id, cu->ipo, NULL, NULL, NULL);
-
+
if (adt->action)
adt->action->idroot = cu->ipo->blocktype;
-
+
id_us_min(&cu->ipo->id);
cu->ipo = NULL;
}
}
-
+
/* --------- Unconverted Animation Data ------------------ */
- /* For Animation data which may not be directly connected (i.e. not linked) to any other
+ /* For Animation data which may not be directly connected (i.e. not linked) to any other
* data, we need to perform a separate pass to make sure that they are converted to standalone
* Actions which may then be able to be reused. This does mean that we will be going over data that's
* already been converted, but there are no problems with that.
*
- * The most common case for this will be Action Constraints, or IPO's with Fake-Users.
- * We collect all drivers that were found into a temporary collection, and free them in one go, as they're
+ * The most common case for this will be Action Constraints, or IPO's with Fake-Users.
+ * We collect all drivers that were found into a temporary collection, and free them in one go, as they're
* impossible to resolve.
*/
-
+
/* actions */
for (id = bmain->action.first; id; id = id->next) {
bAction *act = (bAction *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting action %s\n", id->name + 2);
-
+
/* if old action, it will be object-only... */
if (act->chanbase.first)
act->idroot = ID_OB;
-
+
/* be careful! some of the actions we encounter will be converted ones... */
action_to_animato(NULL, act, &act->groups, &act->curves, &drivers);
}
-
+
/* ipo's */
for (id = bmain->ipo.first; id; id = id->next) {
Ipo *ipo = (Ipo *)id;
-
+
if (G.debug & G_DEBUG) printf("\tconverting ipo %s\n", id->name + 2);
-
+
/* most likely this IPO has already been processed, so check if any curves left to convert */
if (ipo->curve.first) {
bAction *new_act;
-
+
/* add a new action for this, and convert all data into that action */
new_act = BKE_action_add(bmain, id->name + 2);
ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers);
new_act->idroot = ipo->blocktype;
}
-
+
/* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */
ipo->id.us = 0;
ipo->id.flag &= ~LIB_FAKEUSER;
}
-
+
/* free unused drivers from actions + ipos */
free_fcurves(&drivers);
-
+
if (G.debug & G_DEBUG)
printf("INFO: Animato convert done\n");
}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index e63f7d7cefe..4689575655e 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -106,14 +106,14 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
{
Key *key;
char *el;
-
+
key = BKE_libblock_alloc(bmain, ID_KE, "Key", 0);
-
+
key->type = KEY_NORMAL;
key->from = id;
key->uidgen = 1;
-
+
/* XXX the code here uses some defines which will soon be deprecated... */
switch (GS(id->name)) {
case ID_ME:
@@ -150,7 +150,7 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
default:
break;
}
-
+
return key;
}
@@ -192,24 +192,24 @@ Key *BKE_key_copy_nolib(Key *key)
{
Key *keyn;
KeyBlock *kbn, *kb;
-
+
keyn = MEM_dupallocN(key);
keyn->adt = NULL;
BLI_duplicatelist(&keyn->block, &key->block);
-
+
kb = key->block.first;
kbn = keyn->block.first;
while (kbn) {
-
+
if (kbn->data) kbn->data = MEM_dupallocN(kbn->data);
if (kb == key->refkey) keyn->refkey = kbn;
-
+
kbn = kbn->next;
kb = kb->next;
}
-
+
return keyn;
}
@@ -223,7 +223,7 @@ void BKE_key_sort(Key *key)
KeyBlock *kb;
KeyBlock *kb2;
- /* locate the key which is out of position */
+ /* locate the key which is out of position */
for (kb = key->block.first; kb; kb = kb->next)
if ((kb->next) && (kb->pos > kb->next->pos))
break;
@@ -232,7 +232,7 @@ void BKE_key_sort(Key *key)
if (kb) {
kb = kb->next; /* next key is the out-of-order one */
BLI_remlink(&key->block, kb);
-
+
/* find the right location and insert before */
for (kb2 = key->block.first; kb2; kb2 = kb2->next) {
if (kb2->pos > kb->pos) {
@@ -251,7 +251,7 @@ void BKE_key_sort(Key *key)
void key_curve_position_weights(float t, float data[4], int type)
{
float t2, t3, fc;
-
+
if (type == KEY_LINEAR) {
data[0] = 0.0f;
data[1] = -t + 1.0f;
@@ -293,7 +293,7 @@ void key_curve_position_weights(float t, float data[4], int type)
void key_curve_tangent_weights(float t, float data[4], int type)
{
float t2, fc;
-
+
if (type == KEY_LINEAR) {
data[0] = 0.0f;
data[1] = -1.0f;
@@ -332,7 +332,7 @@ void key_curve_tangent_weights(float t, float data[4], int type)
void key_curve_normal_weights(float t, float data[4], int type)
{
float fc;
-
+
if (type == KEY_LINEAR) {
data[0] = 0.0f;
data[1] = 0.0f;
@@ -415,7 +415,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl)
t[3] = k[3]->pos;
k1 = k[3];
}
-
+
while (t[2] < fac) { /* find correct location */
if (k1->next == NULL) {
if (cycl) {
@@ -441,7 +441,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl)
if (ofs > 2.1f + lastpos) break;
}
-
+
bsplinetype = 0;
if (k[1]->type == KEY_BSPLINE || k[2]->type == KEY_BSPLINE) bsplinetype = 1;
@@ -499,7 +499,7 @@ static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3
static void rel_flerp(int tot, float *in, float *ref, float *out, float fac)
{
int a;
-
+
for (a = 0; a < tot; a++) {
in[a] -= fac * (ref[a] - out[a]);
}
@@ -588,7 +588,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
return;
if (end > tot) end = tot;
-
+
if (tot != kb->totelem) {
ktot = 0.0;
flagflo = 1;
@@ -605,9 +605,9 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
/* this exception is needed curves with multiple splines */
if (start != 0) {
-
+
poin += poinsize * start;
-
+
if (flagflo) {
ktot += start * kd;
a = (int)floor(ktot);
@@ -620,13 +620,13 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
k1 += start * key->elemsize;
}
}
-
+
if (mode == KEY_MODE_BEZTRIPLE) {
elemstr[0] = 1;
elemstr[1] = IPO_BEZTRIPLE;
elemstr[2] = 0;
}
-
+
/* just do it here, not above! */
elemsize = key->elemsize;
if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3;
@@ -668,7 +668,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
poin += *ofsp;
cp += 2; ofsp++;
}
-
+
/* are we going to be nasty? */
if (flagflo) {
ktot += kd;
@@ -682,7 +682,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
k1 += elemsize;
kref += elemsize;
}
-
+
if (mode == KEY_MODE_BEZTRIPLE) {
a += 2;
}
@@ -748,13 +748,13 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba
/* step 1 init */
cp_key(start, end, tot, basispoin, key, actkb, key->refkey, NULL, mode);
-
+
/* step 2: do it */
-
+
for (kb = key->block.first, keyblock_index = 0; kb; kb = kb->next, keyblock_index++) {
if (kb != key->refkey) {
float icuval = kb->curval;
-
+
/* only with value, and no difference allowed */
if (!(kb->flag & KEYBLOCK_MUTE) && icuval != 0.0f && kb->totelem == tot) {
KeyBlock *refb;
@@ -764,7 +764,7 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba
/* reference now can be any block */
refb = BLI_findlink(&key->block, kb->relative);
if (refb == NULL) continue;
-
+
poin = basispoin;
from = key_block_get_data(key, actkb, kb, &freefrom);
reffrom = key_block_get_data(key, actkb, refb, &freereffrom);
@@ -772,18 +772,18 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba
poin += start * poinsize;
reffrom += key->elemsize * start; // key elemsize yes!
from += key->elemsize * start;
-
+
for (b = start; b < end; b++) {
-
+
weight = weights ? (*weights * icuval) : icuval;
-
+
cp = key->elemstr;
if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr;
-
+
ofsp = ofs;
-
+
while (cp[0]) { /* (cp[0] == amount) */
-
+
switch (cp[1]) {
case IPO_FLOAT:
rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, weight);
@@ -803,14 +803,14 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba
}
poin += *ofsp;
-
+
cp += 2;
ofsp++;
}
-
+
reffrom += elemsize;
from += elemsize;
-
+
if (mode == KEY_MODE_BEZTRIPLE) b += 2;
if (weights) weights++;
}
@@ -837,7 +837,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
return;
-
+
if (end > tot) end = tot;
k1 = key_block_get_data(key, actkb, k[0], &freek1);
@@ -891,7 +891,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
if (start != 0) {
poin += poinsize * start;
-
+
if (flagdo & 1) {
if (flagflo & 1) {
k1tot += start * k1d;
@@ -957,10 +957,10 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3;
for (a = start; a < end; a++) {
-
+
cp = key->elemstr;
if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr;
-
+
ofsp = ofs;
while (cp[0]) { /* (cp[0] == amount) */
@@ -984,7 +984,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
BLI_assert(!"invalid 'cp[1]'");
return;
}
-
+
poin += *ofsp;
cp += 2;
ofsp++;
@@ -1038,7 +1038,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
k4 += elemsize;
}
}
-
+
if (mode == KEY_MODE_BEZTRIPLE) a += 2;
}
@@ -1055,10 +1055,10 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac
BMIter iter;
BMVert *eve;
int totvert = 0, defgrp_index = 0;
-
+
/* no vgroup string set? */
if (vgroup[0] == 0) return NULL;
-
+
/* gather dvert and totvert */
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
@@ -1073,9 +1073,9 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac
dvert = lt->dvert;
totvert = lt->pntsu * lt->pntsv * lt->pntsw;
}
-
+
if (dvert == NULL) return NULL;
-
+
/* find the group (weak loop-in-loop) */
defgrp_index = defgroup_name_index(ob, vgroup);
if (defgrp_index != -1) {
@@ -1197,7 +1197,7 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float
{
Nurb *nu;
int a, step;
-
+
for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
if (nu->bp) {
step = nu->pntsu * nu->pntsv;
@@ -1217,7 +1217,7 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
{
Nurb *nu;
int a, step;
-
+
for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
if (nu->bp) {
step = nu->pntsu * nu->pntsv;
@@ -1263,7 +1263,7 @@ static void do_latt_key(Object *ob, Key *key, char *out, const int tot)
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag;
-
+
if (key->type == KEY_RELATIVE) {
float **per_keyblock_weights;
per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, NULL);
@@ -1272,7 +1272,7 @@ static void do_latt_key(Object *ob, Key *key, char *out, const int tot)
}
else {
const float ctime_scaled = key->ctime / 100.0f;
-
+
flag = setkeys(ctime_scaled, &key->block, k, t, 0);
if (flag == 0) {
@@ -1331,7 +1331,7 @@ float *BKE_key_evaluate_object_ex(
/* if nothing to interpolate, cancel */
if (tot == 0 || size == 0)
return NULL;
-
+
/* allocate array */
if (arr == NULL) {
out = MEM_callocN(size, "BKE_key_evaluate_object out");
@@ -1346,11 +1346,11 @@ float *BKE_key_evaluate_object_ex(
/* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
key->from = (ID *)ob->data;
-
+
if (ob->shapeflag & OB_SHAPE_LOCK) {
/* shape locked, copy the locked shape instead of blending */
KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
-
+
if (kb && (kb->flag & KEYBLOCK_MUTE))
kb = key->refkey;
@@ -1358,7 +1358,7 @@ float *BKE_key_evaluate_object_ex(
kb = key->block.first;
ob->shapenr = 1;
}
-
+
if (OB_TYPE_SUPPORT_VGROUP(ob->type)) {
float *weights = get_weights_array(ob, kb->vgroup, NULL);
@@ -1370,13 +1370,13 @@ float *BKE_key_evaluate_object_ex(
cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
}
else {
-
+
if (ob->type == OB_MESH) do_mesh_key(ob, key, out, tot);
else if (ob->type == OB_LATTICE) do_latt_key(ob, key, out, tot);
else if (ob->type == OB_CURVE) do_curve_key(ob, key, out, tot);
else if (ob->type == OB_SURF) do_curve_key(ob, key, out, tot);
}
-
+
if (r_totelem) {
*r_totelem = tot;
}
@@ -1451,14 +1451,14 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name)
KeyBlock *kb;
float curpos = -0.1;
int tot;
-
+
kb = key->block.last;
if (kb) curpos = kb->pos;
-
+
kb = MEM_callocN(sizeof(KeyBlock), "Keyblock");
BLI_addtail(&key->block, kb);
kb->type = KEY_CARDINAL;
-
+
tot = BLI_listbase_count(&key->block);
if (name) {
BLI_strncpy(kb->name, name, sizeof(kb->name));
@@ -1476,7 +1476,7 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name)
key->totkey++;
if (key->totkey == 1) key->refkey = kb;
-
+
kb->slidermin = 0.0f;
kb->slidermax = 1.0f;
@@ -1523,10 +1523,10 @@ KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const bool do_force
}
/* only the active keyblock */
-KeyBlock *BKE_keyblock_from_object(Object *ob)
+KeyBlock *BKE_keyblock_from_object(Object *ob)
{
Key *key = BKE_key_from_object(ob);
-
+
if (key) {
KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
return kb;
@@ -1538,7 +1538,7 @@ KeyBlock *BKE_keyblock_from_object(Object *ob)
KeyBlock *BKE_keyblock_from_object_reference(Object *ob)
{
Key *key = BKE_key_from_object(ob);
-
+
if (key)
return key->refkey;
@@ -1550,18 +1550,18 @@ KeyBlock *BKE_keyblock_from_key(Key *key, int index)
{
KeyBlock *kb;
int i;
-
+
if (key) {
kb = key->block.first;
-
+
for (i = 1; i < key->totkey; i++) {
kb = kb->next;
-
+
if (index == i)
return kb;
}
}
-
+
return NULL;
}
@@ -1585,23 +1585,23 @@ void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src)
kb_dst->slidermax = kb_src->slidermax;
}
-/* Get RNA-Path for 'value' setting of the given ShapeKey
+/* Get RNA-Path for 'value' setting of the given ShapeKey
* NOTE: the user needs to free the returned string once they're finish with it
*/
char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
{
PointerRNA ptr;
PropertyRNA *prop;
-
+
/* sanity checks */
if (ELEM(NULL, key, kb))
return NULL;
-
+
/* create the RNA pointer */
RNA_pointer_create(&key->id, &RNA_ShapeKey, kb, &ptr);
/* get pointer to the property too */
prop = RNA_struct_find_property(&ptr, "value");
-
+
/* return the path */
return RNA_path_from_ID_to_property(&ptr, prop);
}
@@ -1689,7 +1689,7 @@ void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *n
}
}
else {
-
+
;
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, fp += 4, bp++) {
copy_v3_v3(fp, bp->vec);
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 2714c4f43a1..3051bbdd7ed 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -100,7 +100,7 @@ void BKE_lamp_init(Lamp *la)
la->sky_colorspace = BLI_XYZ_CIE;
la->sky_exposure = 1.0f;
la->shadow_frustum_size = 10.0f;
-
+
curvemapping_initialize(la->curfalloff);
}
@@ -166,7 +166,7 @@ Lamp *BKE_lamp_localize(Lamp *la)
Lamp *lan;
int a;
-
+
lan = BKE_libblock_copy_nolib(&la->id, false);
for (a = 0; a < MAX_MTEX; a++) {
@@ -175,12 +175,12 @@ Lamp *BKE_lamp_localize(Lamp *la)
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
}
}
-
+
lan->curfalloff = curvemapping_copy(la->curfalloff);
if (la->nodetree)
lan->nodetree = ntreeLocalize(la->nodetree);
-
+
lan->preview = NULL;
return lan;
@@ -198,7 +198,7 @@ void BKE_lamp_free(Lamp *la)
for (a = 0; a < MAX_MTEX; a++) {
MEM_SAFE_FREE(la->mtex[a]);
}
-
+
BKE_animdata_free((ID *)la, false);
curvemapping_free(la->curfalloff);
@@ -209,7 +209,7 @@ void BKE_lamp_free(Lamp *la)
MEM_freeN(la->nodetree);
la->nodetree = NULL;
}
-
+
BKE_previewimg_free(&la->preview);
BKE_icon_id_delete(&la->id);
la->id.icon_id = 0;
@@ -224,7 +224,7 @@ static void lamp_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime
/* nodetree itself */
if (ntree->adt && ntree->adt->drivers.first)
BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS);
-
+
/* nodes */
for (node = ntree->nodes.first; node; node = node->next)
if (node->id && node->type == NODE_GROUP)
@@ -240,11 +240,11 @@ void lamp_drivers_update(Scene *scene, Lamp *la, float ctime)
return;
la->id.tag |= LIB_TAG_DOIT;
-
+
/* lamp itself */
if (la->adt && la->adt->drivers.first)
BKE_animsys_evaluate_animdata(scene, &la->id, la->adt, ctime, ADT_RECALC_DRIVERS);
-
+
/* nodes */
if (la->nodetree)
lamp_node_drivers_update(scene, la->nodetree, ctime);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index edca0257d20..c344cfa157c 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -156,13 +156,13 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
int i, u, v, w;
float fu, fv, fw, uc, vc, wc, du = 0.0, dv = 0.0, dw = 0.0;
float *co, (*vertexCos)[3] = NULL;
-
+
/* vertex weight groups are just freed all for now */
if (lt->dvert) {
BKE_defvert_array_free(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw);
lt->dvert = NULL;
}
-
+
while (uNew * vNew * wNew > 32000) {
if (uNew >= vNew && uNew >= wNew) uNew--;
else if (vNew >= uNew && vNew >= wNew) vNew--;
@@ -207,7 +207,7 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
}
}
}
-
+
if (ltOb) {
float mat[4][4];
int typeu = lt->typeu, typev = lt->typev, typew = lt->typew;
@@ -242,9 +242,9 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
lt->actbp = LT_ACTBP_NONE;
MEM_freeN(lt->def);
lt->def = MEM_callocN(lt->pntsu * lt->pntsv * lt->pntsw * sizeof(BPoint), "lattice bp");
-
+
bp = lt->def;
-
+
for (i = 0; i < lt->pntsu * lt->pntsv * lt->pntsw; i++, bp++) {
copy_v3_v3(bp->vec, vertexCos[i]);
}
@@ -257,9 +257,9 @@ void BKE_lattice_init(Lattice *lt)
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(lt, id));
lt->flag = LT_GRID;
-
+
lt->typeu = lt->typev = lt->typew = KEY_BSPLINE;
-
+
lt->def = MEM_callocN(sizeof(BPoint), "lattvert"); /* temporary */
BKE_lattice_resize(lt, 2, 2, 2, NULL); /* creates a uniform lattice */
lt->actbp = LT_ACTBP_NONE;
@@ -360,14 +360,14 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob)
if (lt->editlatt) lt = lt->editlatt->latt;
bp = lt->def;
-
+
fp = latticedata = MEM_mallocN(sizeof(float) * 3 * lt->pntsu * lt->pntsv * lt->pntsw, "latticedata");
-
+
/* for example with a particle system: (ob == NULL) */
if (ob == NULL) {
/* in deformspace, calc matrix */
invert_m4_m4(latmat, oblatt->obmat);
-
+
/* back: put in deform array */
invert_m4_m4(imat, latmat);
}
@@ -375,11 +375,11 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob)
/* in deformspace, calc matrix */
invert_m4_m4(imat, oblatt->obmat);
mul_m4_m4m4(latmat, imat, ob->obmat);
-
+
/* back: put in deform array */
invert_m4_m4(imat, latmat);
}
-
+
for (w = 0, fw = lt->fw; w < lt->pntsw; w++, fw += lt->dw) {
for (v = 0, fv = lt->fv; v < lt->pntsv; v++, fv += lt->dv) {
for (u = 0, fu = lt->fu; u < lt->pntsu; u++, bp++, co += 3, fp += 3, fu += lt->du) {
@@ -555,7 +555,7 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di
BevList *bl;
float ctime1;
int cycl = 0;
-
+
/* test for cyclic */
bl = ob->curve_cache->bev.first;
if (!bl->nr) return false;
@@ -567,14 +567,14 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di
else {
ctime1 = ctime;
}
-
+
/* vec needs 4 items */
if (where_on_path(ob, ctime1, vec, dir, quat, radius, NULL)) {
-
+
if (cycl == 0) {
Path *path = ob->curve_cache->path;
float dvec[3];
-
+
if (ctime < 0.0f) {
sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec);
mul_v3_fl(dvec, ctime * (float)path->len);
@@ -642,7 +642,7 @@ static bool calc_curve_deform(Scene *scene, Object *par, float co[3],
}
}
}
-
+
if (where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) { /* returns OK */
float quat[4], cent[3];
@@ -688,7 +688,7 @@ static bool calc_curve_deform(Scene *scene, Object *par, float co[3],
/* scale if enabled */
if (cu->flag & CU_PATH_RADIUS)
mul_v3_fl(cent, radius);
-
+
/* local rotation */
normalize_qt(quat);
mul_qt_v3(quat, cent);
@@ -732,7 +732,7 @@ void curve_deform_verts(
cd.dmin[0] = cd.dmin[1] = cd.dmin[2] = -1.0f;
cd.dmax[0] = cd.dmax[1] = cd.dmax[2] = 0.0f;
}
-
+
/* Check whether to use vertex groups (only possible if target is a Mesh or Lattice).
* We want either a Mesh/Lattice with no derived data, or derived data with deformverts.
*/
@@ -805,12 +805,12 @@ void curve_deform_verts(
else {
/* set mesh min max bounds */
INIT_MINMAX(cd.dmin, cd.dmax);
-
+
for (a = 0; a < numVerts; a++) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
minmax_v3v3_v3(cd.dmin, cd.dmax, vertexCos[a]);
}
-
+
for (a = 0; a < numVerts; a++) {
/* already in 'cd.curvespace', prev for loop */
calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
@@ -828,7 +828,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
{
CurveDeform cd;
float quat[4];
-
+
if (cuOb->type != OB_CURVE) {
unit_m3(mat);
return;
@@ -836,21 +836,21 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
init_curve_deform(cuOb, target, &cd);
cd.no_rot_axis = no_rot_axis; /* option to only rotate for XY, for example */
-
+
copy_v3_v3(cd.dmin, orco);
copy_v3_v3(cd.dmax, orco);
mul_m4_v3(cd.curvespace, vec);
-
+
if (calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) {
float qmat[3][3];
-
+
quat_to_mat3(qmat, quat);
mul_m3_m3m3(mat, qmat, cd.objectspace3);
}
else
unit_m3(mat);
-
+
mul_m4_v3(cd.objectspace, vec);
}
@@ -938,11 +938,11 @@ void outside_lattice(Lattice *lt)
if (lt->pntsu > 1) du = 1.0f / ((float)lt->pntsu - 1);
if (lt->pntsv > 1) dv = 1.0f / ((float)lt->pntsv - 1);
if (lt->pntsw > 1) dw = 1.0f / ((float)lt->pntsw - 1);
-
+
for (w = 0; w < lt->pntsw; w++) {
-
+
for (v = 0; v < lt->pntsv; v++) {
-
+
for (u = 0; u < lt->pntsu; u++, bp++) {
if (u == 0 || v == 0 || w == 0 || u == lt->pntsu - 1 || v == lt->pntsv - 1 || w == lt->pntsw - 1) {
/* pass */
@@ -950,41 +950,41 @@ void outside_lattice(Lattice *lt)
else {
bp->hide = 1;
bp->f1 &= ~SELECT;
-
+
/* u extrema */
bp1 = latt_bp(lt, 0, v, w);
bp2 = latt_bp(lt, lt->pntsu - 1, v, w);
-
+
fac1 = du * u;
bp->vec[0] = (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0];
bp->vec[1] = (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1];
bp->vec[2] = (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2];
-
+
/* v extrema */
bp1 = latt_bp(lt, u, 0, w);
bp2 = latt_bp(lt, u, lt->pntsv - 1, w);
-
+
fac1 = dv * v;
bp->vec[0] += (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0];
bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1];
bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2];
-
+
/* w extrema */
bp1 = latt_bp(lt, u, v, 0);
bp2 = latt_bp(lt, u, v, lt->pntsw - 1);
-
+
fac1 = dw * w;
bp->vec[0] += (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0];
bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1];
bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2];
-
+
mul_v3_fl(bp->vec, 1.0f / 3.0f);
-
+
}
}
-
+
}
-
+
}
}
else {
@@ -1005,9 +1005,9 @@ float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3]
if (lt->editlatt) lt = lt->editlatt->latt;
numVerts = *r_numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
-
+
vertexCos = MEM_mallocN(sizeof(*vertexCos) * numVerts, "lt_vcos");
-
+
for (i = 0; i < numVerts; i++) {
copy_v3_v3(vertexCos[i], lt->def[i].vec);
}
@@ -1044,7 +1044,7 @@ void BKE_lattice_modifiers_calc(Scene *scene, Object *ob)
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene = scene;
-
+
if (!(mti->flags & eModifierTypeFlag_AcceptsLattice)) continue;
if (!(md->mode & eModifierMode_Realtime)) continue;
if (editmode && !(md->mode & eModifierMode_Editmode)) continue;
@@ -1057,14 +1057,14 @@ void BKE_lattice_modifiers_calc(Scene *scene, Object *ob)
/* always displist to make this work like derivedmesh */
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts);
-
+
{
DispList *dl = MEM_callocN(sizeof(*dl), "lt_dl");
dl->type = DL_VERTS;
dl->parts = 1;
dl->nr = numVerts;
dl->verts = (float *) vertexCos;
-
+
BLI_addtail(&ob->curve_cache->disp, dl);
}
}
@@ -1146,7 +1146,7 @@ void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3])
}
else {
int i, numVerts;
-
+
if (lt->editlatt) lt = lt->editlatt->latt;
numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index df90c365dbc..37d7004192d 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -139,7 +139,7 @@
# include "PIL_time_utildefines.h"
#endif
-/* GS reads the memory pointed at in a specific ordering.
+/* GS reads the memory pointed at in a specific ordering.
* only use this definition, makes little and big endian systems
* work fine, in conjunction with MAKE_ID */
@@ -685,7 +685,7 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
{
ID *newid = NULL;
PointerRNA idptr;
-
+
if (id) {
/* if property isn't editable, we're going to have an extra block hanging around until we save */
if (RNA_property_editable(ptr, prop)) {
@@ -701,12 +701,12 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
RNA_id_pointer_create(newid, &idptr);
RNA_property_pointer_set(ptr, prop, idptr);
RNA_property_update(C, ptr, prop);
-
+
return true;
}
}
}
-
+
return false;
}
@@ -992,9 +992,9 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[INDEX_ID_TE] = &(main->tex);
lb[INDEX_ID_MA] = &(main->mat);
lb[INDEX_ID_VF] = &(main->vfont);
-
+
/* Important!: When adding a new object type,
- * the specific data should be inserted here
+ * the specific data should be inserted here
*/
lb[INDEX_ID_AR] = &(main->armature);
@@ -1025,7 +1025,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[INDEX_ID_SCE] = &(main->scene);
lb[INDEX_ID_WM] = &(main->wm);
lb[INDEX_ID_MSK] = &(main->mask);
-
+
lb[INDEX_ID_NULL] = NULL;
return (MAX_LIBARRAY - 1);
@@ -1280,7 +1280,7 @@ void BKE_libblock_init_empty(ID *id)
static void id_copy_animdata(Main *bmain, ID *id, const bool do_action)
{
AnimData *adt = BKE_animdata_from_id(id);
-
+
if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate *)id;
iat->adt = BKE_animdata_copy(bmain, iat->adt, do_action); /* could be set to false, need to investigate */
@@ -1383,7 +1383,7 @@ void BKE_main_free(Main *mainvar)
while (a--) {
ListBase *lb = lbarray[a];
ID *id;
-
+
while ( (id = lb->first) ) {
#if 1
BKE_libblock_free_ex(mainvar, id, false, false);
@@ -1623,11 +1623,11 @@ ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *nam
void id_sort_by_name(ListBase *lb, ID *id)
{
ID *idtest;
-
+
/* insert alphabetically */
if (lb->first != lb->last) {
BLI_remlink(lb, id);
-
+
idtest = lb->first;
while (idtest) {
if (BLI_strcasecmp(idtest->name, id->name) > 0 || (idtest->lib && !id->lib)) {
@@ -1641,7 +1641,7 @@ void id_sort_by_name(ListBase *lb, ID *id)
BLI_addtail(lb, id);
}
}
-
+
}
/**
@@ -1651,9 +1651,9 @@ void id_sort_by_name(ListBase *lb, ID *id)
static ID *is_dupid(ListBase *lb, ID *id, const char *name)
{
ID *idtest = NULL;
-
+
for (idtest = lb->first; idtest; idtest = idtest->next) {
- /* if idtest is not a lib */
+ /* if idtest is not a lib */
if (id != idtest && !ID_IS_LINKED(idtest)) {
/* do not test alphabetic! */
/* optimized */
@@ -1662,7 +1662,7 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
}
}
}
-
+
return idtest;
}
@@ -1751,8 +1751,8 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
* or 1 greater than the largest used number if all those low ones are taken.
* We can't be bothered to look for the lowest unused number beyond (MAX_IN_USE - 1). */
- /* If the original name has no numeric suffix,
- * rather than just chopping and adding numbers,
+ /* If the original name has no numeric suffix,
+ * rather than just chopping and adding numbers,
* shave off the end chars until we have a unique name.
* Check the null terminators match as well so we don't get Cube.000 -> Cube.00 */
if (nr == 0 && name[left_len] == '\0') {
@@ -1763,7 +1763,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
len = left_len - 1;
idtest = is_dupid(lb, id, name);
-
+
while (idtest && len > 1) {
name[len--] = '\0';
idtest = is_dupid(lb, id, name);
@@ -1771,7 +1771,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
if (idtest == NULL) return true;
/* otherwise just continue and use a number suffix */
}
-
+
if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
/* this would overflow name buffer */
left[MAX_ID_NAME - 8] = 0;
@@ -1834,7 +1834,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
#endif
id_sort_by_name(lb, id);
-
+
return result;
}
@@ -2349,7 +2349,7 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name)
lb = which_libbase(bmain, GS(name));
if (lb == NULL) return;
-
+
/* search for id */
idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2);
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 2a70e53be92..2819b0312aa 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -1004,7 +1004,7 @@ void BKE_libblock_free(Main *bmain, void *idv)
void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
{
ID *id = idv;
-
+
id_us_min(id);
/* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding groups when deleting an object.
@@ -1020,7 +1020,7 @@ void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
if (id->us == 0) {
BKE_libblock_unlink(bmain, id, false, false);
-
+
BKE_libblock_free(bmain, id);
}
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 3283619587e..74866fd1d94 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -49,8 +49,8 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
-#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_array_utils.h"
@@ -90,14 +90,14 @@ void BKE_material_free(Material *ma)
int a;
BKE_animdata_free((ID *)ma, false);
-
+
for (a = 0; a < MAX_MTEX; a++) {
MEM_SAFE_FREE(ma->mtex[a]);
}
-
+
MEM_SAFE_FREE(ma->ramp_col);
MEM_SAFE_FREE(ma->ramp_spec);
-
+
/* is no lib link block, but material extension */
if (ma->nodetree) {
ntreeFreeTree(ma->nodetree);
@@ -154,13 +154,13 @@ void BKE_material_init(Material *ma)
ma->tx_falloff = 1.0;
ma->shad_alpha = 1.0f;
ma->vcol_alpha = 0;
-
+
ma->gloss_mir = ma->gloss_tra = 1.0;
ma->samp_gloss_mir = ma->samp_gloss_tra = 18;
ma->adapt_thresh_mir = ma->adapt_thresh_tra = 0.005;
ma->dist_mir = 0.0;
ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
-
+
ma->rampfac_col = 1.0;
ma->rampfac_spec = 1.0;
ma->pr_lamp = 3; /* two lamps, is bits */
@@ -197,11 +197,11 @@ void BKE_material_init(Material *ma)
ma->vol.ms_spread = 0.2f;
ma->vol.ms_diff = 1.f;
ma->vol.ms_intensity = 1.f;
-
+
ma->game.flag = GEMAT_BACKCULL;
ma->game.alpha_blend = 0;
ma->game.face_orientation = 0;
-
+
ma->mode = MA_TRACEBLE | MA_SHADBUF | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP;
ma->mode2 = MA_CASTSHADOW;
ma->shade_flag = MA_APPROX_OCCLUSION;
@@ -213,9 +213,9 @@ Material *BKE_material_add(Main *bmain, const char *name)
Material *ma;
ma = BKE_libblock_alloc(bmain, ID_MA, name, 0);
-
+
BKE_material_init(ma);
-
+
return ma;
}
@@ -282,7 +282,7 @@ Material *BKE_material_localize(Material *ma)
Material *man;
int a;
-
+
man = BKE_libblock_copy_nolib(&ma->id, false);
/* no increment for texture ID users, in previewrender.c it prevents decrement */
@@ -292,18 +292,18 @@ Material *BKE_material_localize(Material *ma)
memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
}
}
-
+
if (ma->ramp_col) man->ramp_col = MEM_dupallocN(ma->ramp_col);
if (ma->ramp_spec) man->ramp_spec = MEM_dupallocN(ma->ramp_spec);
man->texpaintslot = NULL;
man->preview = NULL;
-
+
if (ma->nodetree)
man->nodetree = ntreeLocalize(ma->nodetree);
-
+
BLI_listbase_clear(&man->gpumaterial);
-
+
return man;
}
@@ -317,7 +317,7 @@ Material ***give_matarar(Object *ob)
Mesh *me;
Curve *cu;
MetaBall *mb;
-
+
if (ob->type == OB_MESH) {
me = ob->data;
return &(me->mat);
@@ -338,7 +338,7 @@ short *give_totcolp(Object *ob)
Mesh *me;
Curve *cu;
MetaBall *mb;
-
+
if (ob->type == OB_MESH) {
me = ob->data;
return &(me->totcol);
@@ -512,7 +512,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i, bool update_data
DAG_relations_tag_update(bmain);
}
}
-
+
return ret;
}
@@ -546,7 +546,7 @@ Material *give_current_material(Object *ob, short act)
const short *totcolp;
if (ob == NULL) return NULL;
-
+
/* if object cannot have material, (totcolp == NULL) */
totcolp = give_totcolp(ob);
if (totcolp == NULL || ob->totcol == 0) return NULL;
@@ -572,12 +572,12 @@ Material *give_current_material(Object *ob, short act)
if (act > ob->totcol) act = ob->totcol;
matarar = give_matarar(ob);
-
+
if (matarar && *matarar) ma = (*matarar)[act - 1];
else ma = NULL;
-
+
}
-
+
return ma;
}
@@ -720,18 +720,18 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig
if (act > MAXMAT) return;
if (act < 1) act = 1;
-
+
/* prevent crashing when using accidentally */
BLI_assert(!ID_IS_LINKED(ob));
if (ID_IS_LINKED(ob)) return;
-
+
/* test arraylens */
-
+
totcolp = give_totcolp(ob);
matarar = give_matarar(ob);
-
+
if (totcolp == NULL || matarar == NULL) return;
-
+
if (act > *totcolp) {
matar = MEM_callocN(sizeof(void *) * act, "matarray1");
@@ -775,7 +775,7 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig
break;
}
}
-
+
/* do it */
ob->matbits[act - 1] = bit;
@@ -910,14 +910,14 @@ short BKE_object_material_slot_find_index(Object *ob, Material *ma)
{
Material ***matarar;
short a, *totcolp;
-
+
if (ma == NULL) return 0;
-
+
totcolp = give_totcolp(ob);
matarar = give_matarar(ob);
-
+
if (totcolp == NULL || matarar == NULL) return 0;
-
+
for (a = 0; a < *totcolp; a++)
if ((*matarar)[a] == ma)
break;
@@ -930,7 +930,7 @@ bool BKE_object_material_slot_add(Main *bmain, Object *ob)
{
if (ob == NULL) return false;
if (ob->totcol >= MAXMAT) return false;
-
+
assign_material(bmain, ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
ob->actcol = ob->totcol;
return true;
@@ -940,25 +940,25 @@ static void do_init_render_material(Main *bmain, Material *ma, int r_mode, float
{
MTex *mtex;
int a, needuv = 0, needtang = 0;
-
+
if (ma->flarec == 0) ma->flarec = 1;
/* add all texcoflags from mtex, texco and mapto were cleared in advance */
for (a = 0; a < MAX_MTEX; a++) {
-
+
/* separate tex switching */
if (ma->septex & (1 << a)) continue;
mtex = ma->mtex[a];
if (mtex && mtex->tex && (mtex->tex->type | (mtex->tex->use_nodes && mtex->tex->nodetree) )) {
-
+
ma->texco |= mtex->texco;
ma->mapto |= mtex->mapto;
/* always get derivatives for these textures */
if (ELEM(mtex->tex->type, TEX_IMAGE, TEX_ENVMAP)) ma->texco |= TEXCO_OSA;
else if (mtex->texflag & (MTEX_COMPAT_BUMP | MTEX_3TAP_BUMP | MTEX_5TAP_BUMP | MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA;
-
+
if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1;
else if (ma->texco & (TEXCO_GLOB | TEXCO_UV | TEXCO_OBJECT | TEXCO_SPEED)) needuv = 1;
else if (ma->texco & (TEXCO_LAVECTOR | TEXCO_VIEW)) needuv = 1;
@@ -970,13 +970,13 @@ static void do_init_render_material(Main *bmain, Material *ma, int r_mode, float
if (needtang) ma->mode |= MA_NORMAP_TANG;
else ma->mode &= ~MA_NORMAP_TANG;
-
+
if (ma->mode & (MA_VERTEXCOL | MA_VERTEXCOLP | MA_FACETEXTURE)) {
needuv = 1;
if (r_mode & R_OSA) ma->texco |= TEXCO_OSA; /* for texfaces */
}
if (needuv) ma->texco |= NEED_UV;
-
+
/* since the raytracer doesnt recalc O structs for each ray, we have to preset them all */
if (r_mode & R_RAYTRACE) {
if ((ma->mode & (MA_RAYMIRROR | MA_SHADOW_TRA)) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) {
@@ -984,7 +984,7 @@ static void do_init_render_material(Main *bmain, Material *ma, int r_mode, float
if (r_mode & R_OSA) ma->texco |= TEXCO_OSA;
}
}
-
+
if (amb) {
ma->ambr = ma->amb * amb[0];
ma->ambg = ma->amb * amb[1];
@@ -1050,9 +1050,9 @@ static void init_render_nodetree(Main *bmain, bNodeTree *ntree, Material *basema
void init_render_material(Main *bmain, Material *mat, int r_mode, float *amb)
{
-
+
do_init_render_material(bmain, mat, r_mode, amb);
-
+
if (mat->nodetree && mat->use_nodes) {
/* mode_l will take the pipeline options from the main material, and the or-ed
* result of non-pipeline options from the nodes. shadeless is an exception,
@@ -1061,7 +1061,7 @@ void init_render_material(Main *bmain, Material *mat, int r_mode, float *amb)
mat->mode2_l = mat->mode2 & MA_MODE2_PIPELINE;
mat->nmap_tangent_names_count = 0;
init_render_nodetree(bmain, mat->nodetree, mat, r_mode, amb);
-
+
if (!mat->nodetree->execdata)
mat->nodetree->execdata = ntreeShaderBeginExecTree(mat->nodetree);
}
@@ -1077,7 +1077,7 @@ void init_render_material(Main *bmain, Material *mat, int r_mode, float *amb)
void init_render_materials(Main *bmain, int r_mode, float *amb, bool do_default_material)
{
Material *ma;
-
+
/* clear these flags before going over materials, to make sure they
* are cleared only once, otherwise node materials contained in other
* node materials can go wrong */
@@ -1092,7 +1092,7 @@ void init_render_materials(Main *bmain, int r_mode, float *amb, bool do_default_
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
/* is_used flag comes back in convertblender.c */
ma->flag &= ~MA_IS_USED;
- if (ma->id.us)
+ if (ma->id.us)
init_render_material(bmain, ma, r_mode, amb);
}
@@ -1114,7 +1114,7 @@ void end_render_materials(Main *bmain)
{
Material *ma;
for (ma = bmain->mat.first; ma; ma = ma->id.next)
- if (ma->id.us)
+ if (ma->id.us)
end_render_material(ma);
}
@@ -1162,7 +1162,7 @@ static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float c
if (ntree->adt && ntree->adt->drivers.first) {
BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS);
}
-
+
/* nodes */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id) {
@@ -1176,7 +1176,7 @@ static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float c
}
}
-/* Calculate all drivers for materials
+/* Calculate all drivers for materials
* FIXME: this is really a terrible method which may result in some things being calculated
* multiple times. However, without proper despgraph support for these things, we are forced
* into this sort of thing...
@@ -1185,7 +1185,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
{
//if (G.f & G_DEBUG)
// printf("material_drivers_update(%s, %s)\n", scene->id.name, ma->id.name);
-
+
/* Prevent infinite recursion by checking (and tagging the material) as having been visited already
* (see BKE_scene_update_tagged()). This assumes ma->id.tag & LIB_TAG_DOIT isn't set by anything else
* in the meantime... [#32017]
@@ -1194,12 +1194,12 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
return;
ma->id.tag |= LIB_TAG_DOIT;
-
+
/* material itself */
if (ma->adt && ma->adt->drivers.first) {
BKE_animsys_evaluate_animdata(scene, &ma->id, ma->adt, ctime, ADT_RECALC_DRIVERS);
}
-
+
/* nodes */
if (ma->nodetree) {
material_node_drivers_update(scene, ma->nodetree, ctime);
@@ -1213,7 +1213,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
Material *mao, ***matarar;
short *totcolp;
short a, actcol;
-
+
if (ob == NULL || ob->totcol == 0) {
return false;
}
@@ -1227,10 +1227,10 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
/* take a mesh/curve/mball as starting point, remove 1 index,
* AND with all objects that share the ob->data
- *
+ *
* after that check indices in mesh/curve/mball!!!
*/
-
+
totcolp = give_totcolp(ob);
matarar = give_matarar(ob);
@@ -1242,21 +1242,21 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
if (ob->actcol > ob->totcol) {
ob->actcol = ob->totcol;
}
-
+
/* we delete the actcol */
mao = (*matarar)[ob->actcol - 1];
if (mao)
id_us_min(&mao->id);
-
+
for (a = ob->actcol; a < ob->totcol; a++)
(*matarar)[a - 1] = (*matarar)[a];
(*totcolp)--;
-
+
if (*totcolp == 0) {
MEM_freeN(*matarar);
*matarar = NULL;
}
-
+
actcol = ob->actcol;
for (Object *obt = bmain->object.first; obt; obt = obt->id.next) {
@@ -1269,14 +1269,14 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
mao = obt->mat[actcol - 1];
if (mao)
id_us_min(&mao->id);
-
+
for (a = actcol; a < obt->totcol; a++) {
obt->mat[a - 1] = obt->mat[a];
obt->matbits[a - 1] = obt->matbits[a];
}
obt->totcol--;
if (obt->actcol > obt->totcol) obt->actcol = obt->totcol;
-
+
if (obt->totcol == 0) {
MEM_freeN(obt->mat);
MEM_freeN(obt->matbits);
@@ -1308,7 +1308,7 @@ static bNode *nodetree_uv_node_recursive(bNode *node)
{
bNode *inode;
bNodeSocket *sock;
-
+
for (sock = node->inputs.first; sock; sock = sock->next) {
if (sock->link) {
inode = sock->link->fromnode;
@@ -1320,7 +1320,7 @@ static bNode *nodetree_uv_node_recursive(bNode *node)
}
}
}
-
+
return NULL;
}
@@ -1332,7 +1332,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
bool use_nodes = BKE_scene_use_new_shading_nodes(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
-
+
if (!ma)
return;
@@ -1347,7 +1347,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
ma->paint_clone_slot = 0;
return;
}
-
+
if (use_nodes || ma->use_nodes) {
bNode *node, *active_node;
@@ -1376,11 +1376,11 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
if (active_node == node)
ma->paint_active_slot = index;
ma->texpaintslot[index].ima = (Image *)node->id;
-
+
/* for new renderer, we need to traverse the treeback in search of a UV node */
if (use_nodes) {
bNode *uvnode = nodetree_uv_node_recursive(node);
-
+
if (uvnode) {
NodeShaderUVMap *storage = (NodeShaderUVMap *)uvnode->storage;
ma->texpaintslot[index].uvname = storage->uv_map;
@@ -1419,7 +1419,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
ma->texpaintslot[index].ima = (*mtex)->tex->ima;
ma->texpaintslot[index].uvname = (*mtex)->uvname;
ma->texpaintslot[index].index = i;
-
+
index++;
}
}
@@ -1428,12 +1428,12 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
ma->paint_active_slot = 0;
ma->paint_clone_slot = 0;
return;
- }
+ }
ma->tot_slots = count;
-
-
+
+
if (ma->paint_active_slot >= count) {
ma->paint_active_slot = count - 1;
}
@@ -1460,7 +1460,7 @@ void BKE_texpaint_slots_refresh_object(Scene *scene, struct Object *ob)
void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
{
float tmp, facm = 1.0f - fac;
-
+
switch (type) {
case MA_RAMP_BLEND:
r_col[0] = facm * (r_col[0]) + fac * col[0];
@@ -1806,10 +1806,10 @@ static int encode_tfaceflag(MTFace *tf, int convertall)
/* light tface flag is ignored in GLSL mode */
flag &= ~TF_LIGHT;
-
+
/* 15 is how big the flag can be - hardcoded here and in decode_tfaceflag() */
flag |= tf->transp << 15;
-
+
/* increase 1 so flag 0 is different than no flag yet */
return flag + 1;
}
@@ -1825,25 +1825,25 @@ static void decode_tfaceflag(Material *ma, int flag, int convertall)
alphablend = flag >> 15; /* encoded in the encode_tfaceflag function */
(*game).flag = 0;
-
+
/* General Material Options */
if ((flag & TF_DYNAMIC) == 0) (*game).flag |= GEMAT_NOPHYSICS;
-
+
/* Material Offline Rendering Properties */
if (convertall) {
if (flag & TF_OBCOL) ma->shade_flag |= MA_OBCOLOR;
}
-
+
/* Special Face Properties */
if ((flag & TF_TWOSIDE) == 0) (*game).flag |= GEMAT_BACKCULL;
if (flag & TF_INVISIBLE) (*game).flag |= GEMAT_INVISIBLE;
if (flag & TF_BMFONT) (*game).flag |= GEMAT_TEXT;
-
+
/* Face Orientation */
if (flag & TF_BILLBOARD) (*game).face_orientation |= GEMAT_HALO;
else if (flag & TF_BILLBOARD2) (*game).face_orientation |= GEMAT_BILLBOARD;
else if (flag & TF_SHADOW) (*game).face_orientation |= GEMAT_SHADOW;
-
+
/* Alpha Blend */
if (flag & TF_ALPHASORT && ELEM(alphablend, TF_ALPHA, TF_ADD)) (*game).alpha_blend = GEMAT_ALPHA_SORT;
else if (alphablend & TF_ALPHA) (*game).alpha_blend = GEMAT_ALPHA;
@@ -1867,7 +1867,7 @@ static int check_tfaceneedmaterial(int flag)
/* light tface flag is ignored in GLSL mode */
flag &= ~TF_LIGHT;
-
+
/* automatic detected if tex image has alpha */
flag &= ~(TF_ALPHA << 15);
/* automatic detected if using texture */
@@ -1948,7 +1948,7 @@ static short convert_tfacenomaterial(Main *bmain, Mesh *me, MTFace *tf, int flag
Material *ma;
char idname[MAX_ID_NAME];
short mat_nr = -1;
-
+
/* new material, the name uses the flag*/
BLI_snprintf(idname, sizeof(idname), "MAMaterial.TF.%0*d", integer_getdigits(flag), flag);
@@ -1967,7 +1967,7 @@ static short convert_tfacenomaterial(Main *bmain, Mesh *me, MTFace *tf, int flag
if (ma) {
printf("TexFace Convert: Material \"%s\" created.\n", idname + 2);
mat_nr = mesh_addmaterial(bmain, me, ma);
-
+
/* if needed set "Face Textures [Alpha]" Material options */
set_facetexture_flags(ma, tf->tpage);
@@ -2005,7 +2005,7 @@ static void convert_tfacematerial(Main *bmain, Material *ma)
/* check if this mesh uses this material */
for (a = 0; a < me->totcol; a++)
if (me->mat[a] == ma) break;
-
+
/* no material found */
if (a == me->totcol) continue;
@@ -2048,9 +2048,9 @@ static void convert_tfacematerial(Main *bmain, Material *ma)
continue;
}
}
-
+
/* if the material has a texture but no texture channel
- * set "Face Textures [Alpha]" Material options
+ * set "Face Textures [Alpha]" Material options
* actually we need to run it always, because of old behavior
* of using face texture if any texture channel was present (multitex) */
//if ((!mat_new->mtex[0]) && (!mat_new->mtex[0]->tex))
@@ -2084,7 +2084,7 @@ int do_version_tface(Main *main)
int a;
int flag;
int index;
-
+
/* Operator in help menu has been removed for 2.7x */
int fileload = 1;
@@ -2100,9 +2100,9 @@ int do_version_tface(Main *main)
/* mark all the materials to conversion with a flag
* if there is tface create a complete flag for that storing in flag
* if there is tface and flag > 0: creates a new flag based on this face
- * if flags are different set flag to -1
+ * if flags are different set flag to -1
*/
-
+
/* 1st part: marking mesh materials to update */
for (me = main->mesh.first; me; me = me->id.next) {
if (ID_IS_LINKED(me)) continue;
@@ -2113,7 +2113,7 @@ int do_version_tface(Main *main)
if (!cdl) continue;
nomaterialslots = (me->totcol == 0 ? 1 : 0);
-
+
/* loop over all the faces*/
for (a = 0, mf = me->mface; a < me->totface; a++, mf++) {
/* texface data for this face */
@@ -2126,11 +2126,11 @@ int do_version_tface(Main *main)
if ((tf->mode & TF_CONVERTED)) continue;
else tf->mode |= TF_CONVERTED;
}
-
+
/* no material slots */
if (nomaterialslots) {
flag = encode_tfaceflag(tf, 1);
-
+
/* create/find a new material and assign to the face */
if (check_tfaceneedmaterial(flag)) {
mf->mat_nr = convert_tfacenomaterial(main, me, tf, flag);
@@ -2142,7 +2142,7 @@ int do_version_tface(Main *main)
}
else if (mf->mat_nr < me->totcol) {
ma = me->mat[mf->mat_nr];
-
+
/* no material create one if necessary */
if (!ma) {
/* find a new material and assign to the face */
@@ -2161,7 +2161,7 @@ int do_version_tface(Main *main)
* later we could, but it's better not */
else if (ID_IS_LINKED(ma))
continue;
-
+
/* material already marked as disputed */
else if (ma->game.flag == MAT_BGE_DISPUTED)
continue;
@@ -2173,17 +2173,17 @@ int do_version_tface(Main *main)
/* first time changing this material */
if (ma->game.flag == 0)
ma->game.flag = -flag;
-
+
/* mark material as disputed */
else if (ma->game.flag != -flag) {
ma->game.flag = MAT_BGE_DISPUTED;
continue;
}
-
+
/* material ok so far */
else {
ma->game.flag = -flag;
-
+
/* some people uses multitexture with TexFace by creating a texture
* channel which not necessarily the tf->tpage image. But the game engine
* was enabling it. Now it's required to set "Face Texture [Alpha] in the
@@ -2218,7 +2218,7 @@ int do_version_tface(Main *main)
}
}
-
+
/* 2nd part - conversion */
/* skip library files */
@@ -2238,7 +2238,7 @@ int do_version_tface(Main *main)
}
continue;
}
-
+
/* no conflicts in this material - 90% of cases
* convert from tface system to material */
else if (ma->game.flag < 0) {
@@ -2251,15 +2251,15 @@ int do_version_tface(Main *main)
/* check if this mesh uses this material */
for (a = 0; a < me->totcol; a++)
if (me->mat[a] == ma) break;
-
+
/* no material found */
if (a == me->totcol) continue;
-
+
/* get the active tface layer */
index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
cdl = (index == -1) ? NULL : &me->fdata.layers[index];
if (!cdl) continue;
-
+
/* loop over all the faces and stop at the ones that use the material*/
for (a = 0, mf = me->mface; a < me->totface; a++, mf++) {
if (me->mat[mf->mat_nr] == ma) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 8438957b0ef..9e926e5ef53 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -86,7 +86,7 @@ void BKE_mball_init(MetaBall *mb)
mb->size[0] = mb->size[1] = mb->size[2] = 1.0;
mb->texflag = MB_AUTOSPACE;
-
+
mb->wiresize = 0.4f;
mb->rendersize = 0.2f;
mb->thresh = 0.6f;
@@ -197,7 +197,7 @@ void BKE_mball_texspace_calc(Object *ob)
if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox");
bb = ob->bb;
-
+
/* Weird one, this. */
/* INIT_MINMAX(min, max); */
(min)[0] = (min)[1] = (min)[2] = 1.0e30f;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 770d482b33b..4fabf9ebdf8 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -106,7 +106,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
const float thresh_sq = thresh * thresh;
CustomDataLayer *l1, *l2;
int i, i1 = 0, i2 = 0, tot, j;
-
+
for (i = 0; i < c1->totlayer; i++) {
if (ELEM(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
@@ -125,7 +125,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
if (i1 != i2)
return MESHCMP_CDLAYERS_MISMATCH;
-
+
l1 = c1->layers; l2 = c2->layers;
tot = i1;
i1 = 0; i2 = 0;
@@ -143,52 +143,52 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
i2++;
l2++;
}
-
+
if (l1->type == CD_MVERT) {
MVert *v1 = l1->data;
MVert *v2 = l2->data;
int vtot = m1->totvert;
-
+
for (j = 0; j < vtot; j++, v1++, v2++) {
if (len_squared_v3v3(v1->co, v2->co) > thresh_sq)
return MESHCMP_VERTCOMISMATCH;
/* I don't care about normals, let's just do coodinates */
}
}
-
+
/*we're order-agnostic for edges here*/
if (l1->type == CD_MEDGE) {
MEdge *e1 = l1->data;
MEdge *e2 = l2->data;
int etot = m1->totedge;
EdgeHash *eh = BLI_edgehash_new_ex(__func__, etot);
-
+
for (j = 0; j < etot; j++, e1++) {
BLI_edgehash_insert(eh, e1->v1, e1->v2, e1);
}
-
+
for (j = 0; j < etot; j++, e2++) {
if (!BLI_edgehash_lookup(eh, e2->v1, e2->v2))
return MESHCMP_EDGEUNKNOWN;
}
BLI_edgehash_free(eh, NULL);
}
-
+
if (l1->type == CD_MPOLY) {
MPoly *p1 = l1->data;
MPoly *p2 = l2->data;
int ptot = m1->totpoly;
-
+
for (j = 0; j < ptot; j++, p1++, p2++) {
MLoop *lp1, *lp2;
int k;
-
+
if (p1->totloop != p2->totloop)
return MESHCMP_POLYMISMATCH;
-
+
lp1 = m1->mloop + p1->loopstart;
lp2 = m2->mloop + p2->loopstart;
-
+
for (k = 0; k < p1->totloop; k++, lp1++, lp2++) {
if (lp1->v != lp2->v)
return MESHCMP_POLYVERTMISMATCH;
@@ -199,7 +199,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MLoop *lp1 = l1->data;
MLoop *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
if (lp1->v != lp2->v)
return MESHCMP_LOOPMISMATCH;
@@ -209,22 +209,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MLoopUV *lp1 = l1->data;
MLoopUV *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
if (len_squared_v2v2(lp1->uv, lp2->uv) > thresh_sq)
return MESHCMP_LOOPUVMISMATCH;
}
}
-
+
if (l1->type == CD_MLOOPCOL) {
MLoopCol *lp1 = l1->data;
MLoopCol *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
- if (ABS(lp1->r - lp2->r) > thresh ||
- ABS(lp1->g - lp2->g) > thresh ||
- ABS(lp1->b - lp2->b) > thresh ||
+ if (ABS(lp1->r - lp2->r) > thresh ||
+ ABS(lp1->g - lp2->g) > thresh ||
+ ABS(lp1->b - lp2->b) > thresh ||
ABS(lp1->a - lp2->a) > thresh)
{
return MESHCMP_LOOPCOLMISMATCH;
@@ -236,14 +236,14 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MDeformVert *dv1 = l1->data;
MDeformVert *dv2 = l2->data;
int dvtot = m1->totvert;
-
+
for (j = 0; j < dvtot; j++, dv1++, dv2++) {
int k;
MDeformWeight *dw1 = dv1->dw, *dw2 = dv2->dw;
-
+
if (dv1->totweight != dv2->totweight)
return MESHCMP_DVERT_TOTGROUPMISMATCH;
-
+
for (k = 0; k < dv1->totweight; k++, dw1++, dw2++) {
if (dw1->def_nr != dw2->def_nr)
return MESHCMP_DVERT_GROUPMISMATCH;
@@ -253,7 +253,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
}
}
}
-
+
return 0;
}
@@ -266,22 +266,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
{
int c;
-
+
if (!me1 || !me2)
return "Requires two input meshes";
-
- if (me1->totvert != me2->totvert)
+
+ if (me1->totvert != me2->totvert)
return "Number of verts don't match";
-
+
if (me1->totedge != me2->totedge)
return "Number of edges don't match";
-
+
if (me1->totpoly != me2->totpoly)
return "Number of faces don't match";
-
+
if (me1->totloop != me2->totloop)
return "Number of loops don't match";
-
+
if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh)))
return cmpcode_to_str(c);
@@ -293,7 +293,7 @@ const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh)))
return cmpcode_to_str(c);
-
+
return NULL;
}
@@ -400,7 +400,7 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd)
me->mface = CustomData_get_layer(&me->fdata, CD_MFACE);
me->mcol = CustomData_get_layer(&me->fdata, CD_MCOL);
me->mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
-
+
me->mpoly = CustomData_get_layer(&me->pdata, CD_MPOLY);
me->mloop = CustomData_get_layer(&me->ldata, CD_MLOOP);
@@ -673,13 +673,13 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
BoundBox *bb;
float min[3], max[3];
float mloc[3], msize[3];
-
+
if (me->bb == NULL) me->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
bb = me->bb;
if (!r_loc) r_loc = mloc;
if (!r_size) r_size = msize;
-
+
INIT_MINMAX(min, max);
if (!BKE_mesh_minmax(me, min, max)) {
min[0] = min[1] = min[2] = -1.0f;
@@ -687,11 +687,11 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
}
mid_v3_v3v3(r_loc, min, max);
-
+
r_size[0] = (max[0] - min[0]) / 2.0f;
r_size[1] = (max[1] - min[1]) / 2.0f;
r_size[2] = (max[2] - min[2]) / 2.0f;
-
+
BKE_boundbox_init_from_minmax(bb, min, max);
bb->flag &= ~BOUNDBOX_DIRTY;
@@ -874,7 +874,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
Mesh *BKE_mesh_from_object(Object *ob)
{
-
+
if (ob == NULL) return NULL;
if (ob->type == OB_MESH) return ob->data;
else return NULL;
@@ -885,9 +885,9 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
Mesh *old = NULL;
multires_force_update(ob);
-
+
if (ob == NULL) return;
-
+
if (ob->type == OB_MESH) {
old = ob->data;
if (old)
@@ -895,7 +895,7 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
ob->data = me;
id_us_plus((ID *)me);
}
-
+
test_object_materials(bmain, ob, (ID *)me);
test_object_modifiers(ob);
@@ -966,7 +966,7 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r
}
-void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
+void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
{
Mesh *me = meshOb->data;
int i;
@@ -981,7 +981,7 @@ void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
mp->flag &= ~ME_SMOOTH;
}
}
-
+
for (i = 0; i < me->totface; i++) {
MFace *mf = &me->mface[i];
@@ -1023,7 +1023,7 @@ int poly_find_loop_from_vert(
if (loopstart->v == vert)
return j;
}
-
+
return -1;
}
@@ -1040,7 +1040,7 @@ int poly_get_adj_loops_from_vert(
int corner = poly_find_loop_from_vert(poly,
&mloop[poly->loopstart],
vert);
-
+
if (corner != -1) {
#if 0 /* unused - this loop */
const MLoop *ml = &mloop[poly->loopstart + corner];
@@ -1076,7 +1076,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3])
for (mvert = me->mvert; i--; mvert++) {
minmax_v3v3_v3(r_min, r_max, mvert->co);
}
-
+
return (me->totvert != 0);
}
@@ -1119,7 +1119,7 @@ void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
for (mvert = me->mvert; i--; mvert++) {
add_v3_v3(mvert->co, offset);
}
-
+
if (do_keys && me->key) {
KeyBlock *kb;
for (kb = me->key->block.first; kb; kb = kb->next) {
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index a67c9de6deb..0c6693be3af 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -165,7 +165,7 @@ void BKE_mesh_calc_normals_mapping_ex(
/* if (fnors != r_faceNors) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */
fnors = pnors = NULL;
-
+
}
typedef struct MeshCalcNormalsData {
@@ -178,7 +178,7 @@ typedef struct MeshCalcNormalsData {
} MeshCalcNormalsData;
static void mesh_calc_normals_poly_cb(
- void *__restrict userdata,
+ void *__restrict userdata,
const int pidx,
const ParallelRangeTLS *__restrict UNUSED(tls))
{
@@ -189,7 +189,7 @@ static void mesh_calc_normals_poly_cb(
}
static void mesh_calc_normals_poly_prepare_cb(
- void *__restrict userdata,
+ void *__restrict userdata,
const int pidx,
const ParallelRangeTLS *__restrict UNUSED(tls))
{
@@ -378,14 +378,14 @@ void BKE_mesh_calc_normals_tessface(
for (i = 0; i < numVerts; i++) {
MVert *mv = &mverts[i];
float *no = tnorms[i];
-
+
if (UNLIKELY(normalize_v3(no) == 0.0f)) {
normalize_v3_v3(no, mv->co);
}
normal_float_to_short_v3(mv->no, no);
}
-
+
cleanup:
MEM_freeN(tnorms);
@@ -2442,19 +2442,19 @@ static bool mesh_calc_center_centroid_ex(
const MLoopTri *lt;
float totweight;
int i;
-
+
zero_v3(r_center);
-
+
if (looptri_num == 0)
return false;
-
+
totweight = 0.0f;
for (i = 0, lt = looptri; i < looptri_num; i++, lt++) {
const MVert *v1 = &mverts[mloop[lt->tri[0]].v];
const MVert *v2 = &mverts[mloop[lt->tri[1]].v];
const MVert *v3 = &mverts[mloop[lt->tri[2]].v];
float area;
-
+
area = area_tri_v3(v1->co, v2->co, v3->co);
madd_v3_v3fl(r_center, v1->co, area);
madd_v3_v3fl(r_center, v2->co, area);
@@ -2463,9 +2463,9 @@ static bool mesh_calc_center_centroid_ex(
}
if (totweight == 0.0f)
return false;
-
+
mul_v3_fl(r_center, 1.0f / (3.0f * totweight));
-
+
return true;
}
@@ -2485,18 +2485,18 @@ void BKE_mesh_calc_volume(
float center[3];
float totvol;
int i;
-
+
if (r_volume)
*r_volume = 0.0f;
if (r_center)
zero_v3(r_center);
-
+
if (looptri_num == 0)
return;
-
+
if (!mesh_calc_center_centroid_ex(mverts, mverts_num, looptri, looptri_num, mloop, center))
return;
-
+
totvol = 0.0f;
for (i = 0, lt = looptri; i < looptri_num; i++, lt++) {
@@ -2504,7 +2504,7 @@ void BKE_mesh_calc_volume(
const MVert *v2 = &mverts[mloop[lt->tri[1]].v];
const MVert *v3 = &mverts[mloop[lt->tri[2]].v];
float vol;
-
+
vol = volume_tetrahedron_signed_v3(center, v1->co, v2->co, v3->co);
if (r_volume) {
totvol += vol;
@@ -2516,7 +2516,7 @@ void BKE_mesh_calc_volume(
madd_v3_v3fl(r_center, v3->co, vol);
}
}
-
+
/* Note: Depending on arbitrary centroid position,
* totvol can become negative even for a valid mesh.
* The true value is always the positive value.
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 368a691e778..9fc3fc4ba64 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -121,7 +121,7 @@ ModifierData *modifier_new(int type)
{
const ModifierTypeInfo *mti = modifierType_getInfo(type);
ModifierData *md = MEM_callocN(mti->structSize, mti->structName);
-
+
/* note, this name must be made unique later */
BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
@@ -478,7 +478,7 @@ bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode
if (scene != NULL && mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return false;
if (md->mode & eModifierMode_DisableTemporary) return false;
if ((required_mode & eModifierMode_Editmode) && !(mti->flags & eModifierTypeFlag_SupportsEditmode)) return false;
-
+
return true;
}
@@ -494,7 +494,7 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierDat
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink");
-
+
if (modifier_isEnabled(scene, md, required_mode)) {
if (mti->requiredDataMask)
curr->mask = mti->requiredDataMask(ob, md);
@@ -603,7 +603,7 @@ Object *modifiers_isDeformedByArmature(Object *ob)
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
ArmatureModifierData *amd = NULL;
-
+
/* return the first selected armature, this lets us use multiple armatures */
for (; md; md = md->next) {
if (md->type == eModifierType_Armature) {
@@ -612,10 +612,10 @@ Object *modifiers_isDeformedByArmature(Object *ob)
return amd->object;
}
}
-
+
if (amd) /* if were still here then return the last armature */
return amd->object;
-
+
return NULL;
}
@@ -627,7 +627,7 @@ Object *modifiers_isDeformedByLattice(Object *ob)
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
LatticeModifierData *lmd = NULL;
-
+
/* return the first selected lattice, this lets us use multiple lattices */
for (; md; md = md->next) {
if (md->type == eModifierType_Lattice) {
@@ -636,10 +636,10 @@ Object *modifiers_isDeformedByLattice(Object *ob)
return lmd->object;
}
}
-
+
if (lmd) /* if were still here then return the last lattice */
return lmd->object;
-
+
return NULL;
}
@@ -651,7 +651,7 @@ Object *modifiers_isDeformedByCurve(Object *ob)
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
CurveModifierData *cmd = NULL;
-
+
/* return the first selected curve, this lets us use multiple curves */
for (; md; md = md->next) {
if (md->type == eModifierType_Curve) {
@@ -660,10 +660,10 @@ Object *modifiers_isDeformedByCurve(Object *ob)
return cmd->object;
}
}
-
+
if (cmd) /* if were still here then return the last curve */
return cmd->object;
-
+
return NULL;
}
@@ -697,7 +697,7 @@ bool modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob)
if (ob->mode == OB_MODE_EDIT)
required_mode |= eModifierMode_Editmode;
-
+
for (; md; md = md->next) {
if (!modifier_isEnabled(scene, md, required_mode)) {
/* pass */
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 9c8fc9bfd0c..636157b08dd 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -189,7 +189,7 @@ static BLI_bitmap *multires_mdisps_downsample_hidden(BLI_bitmap *old_hidden,
for (x = 0; x < new_gridsize; x++) {
old_value = BLI_BITMAP_TEST(old_hidden,
factor * y * old_gridsize + x * factor);
-
+
BLI_BITMAP_SET(new_hidden, y * new_gridsize + x, old_value);
}
}
@@ -204,7 +204,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
BLI_bitmap **grid_hidden = ccgdm->gridHidden;
int *gridOffset;
int i, j;
-
+
gridOffset = ccgdm->dm.getGridOffset(&ccgdm->dm);
for (i = 0; i < me->totpoly; i++) {
@@ -212,7 +212,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
int g = gridOffset[i] + j;
const MDisps *md = &mdisps[g];
BLI_bitmap *gh = md->hidden;
-
+
if (gh) {
grid_hidden[g] =
multires_mdisps_downsample_hidden(gh, md->level, level);
@@ -226,7 +226,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
{
BLI_bitmap *subd;
-
+
BLI_assert(md->hidden);
/* nothing to do if already subdivided enough */
@@ -237,7 +237,7 @@ static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
md->level,
new_level,
NULL);
-
+
/* swap in the subdivided data */
MEM_freeN(md->hidden);
md->hidden = subd;
@@ -250,7 +250,7 @@ static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level)
int gridsize = BKE_ccg_gridsize(level);
int gridarea = SQUARE(gridsize);
int i, j;
-
+
for (i = 0; i < me->totpoly; i++) {
bool hide = false;
@@ -474,7 +474,7 @@ static int get_levels_from_disps(Object *ob)
for (j = 0; j < me->mpoly[i].totloop; j++, md++) {
if (md->totdisp == 0) continue;
-
+
while (1) {
int side = (1 << (totlvl - 1)) + 1;
int lvl_totdisp = side * side;
@@ -484,9 +484,9 @@ static int get_levels_from_disps(Object *ob)
totlvl--;
else
totlvl++;
-
+
}
-
+
break;
}
}
@@ -537,7 +537,7 @@ static void multires_reallocate_mdisps(int totloop, MDisps *mdisps, int lvl)
if (mdisps[i].disps)
MEM_freeN(mdisps[i].disps);
-
+
if (mdisps[i].level && mdisps[i].hidden)
multires_mdisps_subdivide_hidden(&mdisps[i], lvl);
@@ -735,7 +735,7 @@ static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl
if (alloc_paint_mask)
flags |= SUBSURF_ALLOC_PAINT_MASK;
-
+
return subsurf_make_derived_from_derived(dm, &smd, NULL, flags);
}
@@ -801,7 +801,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
/* find center */
for (j = 0; j < pmap[i].count; j++) {
const MPoly *p = &me->mpoly[pmap[i].indices[j]];
-
+
/* this double counts, not sure if that's bad or good */
for (k = 0; k < p->totloop; ++k) {
int vndx = me->mloop[p->loopstart + k].v;
@@ -827,18 +827,18 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
fake_poly.loopstart = 0;
fake_loops = MEM_malloc_arrayN(p->totloop, sizeof(MLoop), "fake_loops");
fake_co = MEM_malloc_arrayN(p->totloop, 3 * sizeof(float), "fake_co");
-
+
for (k = 0; k < p->totloop; ++k) {
int vndx = me->mloop[p->loopstart + k].v;
-
+
fake_loops[k].v = k;
-
+
if (vndx == i)
copy_v3_v3(fake_co[k], center);
else
copy_v3_v3(fake_co[k], origco[vndx]);
}
-
+
BKE_mesh_calc_poly_normal_coords(&fake_poly, fake_loops,
(const float(*)[3])fake_co, no);
MEM_freeN(fake_loops);
@@ -853,7 +853,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
copy_v3_v3(push, avg_no);
mul_v3_fl(push, dist);
add_v3_v3(me->mvert[i].co, push);
-
+
}
MEM_freeN(origco);
@@ -942,7 +942,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
ccgSubSurf_updateLevels(ss, lvl, NULL, 0);
/* reallocate displacements */
- multires_reallocate_mdisps(me->totloop, mdisps, totlvl);
+ multires_reallocate_mdisps(me->totloop, mdisps, totlvl);
/* compute displacements */
multiresModifier_disp_run(highdm, me, NULL, CALC_DISPLACEMENTS, subGridData, totlvl);
@@ -955,7 +955,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
}
else {
/* only reallocate, nothing to upsample */
- multires_reallocate_mdisps(me->totloop, mdisps, totlvl);
+ multires_reallocate_mdisps(me->totloop, mdisps, totlvl);
}
multires_set_tot_level(ob, mmd, totlvl);
@@ -1128,7 +1128,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
int *gridOffset;
int i, gridSize, dGridSize, dSkip;
int totloop, totpoly;
-
+
/* this happens in the dm made by bmesh_mdisps_space_set */
if (dm2 && CustomData_has_layer(&dm2->loopData, CD_MDISPS)) {
mpoly = CustomData_get_layer(&dm2->polyData, CD_MPOLY);
@@ -1140,7 +1140,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
totloop = me->totloop;
totpoly = me->totpoly;
}
-
+
if (!mdisps) {
if (op == CALC_DISPLACEMENTS)
mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS, CD_DEFAULT, NULL, me->totloop);
@@ -1214,7 +1214,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
if (mdisps) {
int lvl = ccgdm->multires.lvl;
int totlvl = ccgdm->multires.totlvl;
-
+
if (lvl < totlvl) {
DerivedMesh *lowdm, *cddm, *highdm;
CCGElem **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
@@ -1311,7 +1311,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm)
if (mdisps) {
int i;
-
+
for (i = 0; i < me->totloop; i++) {
MDisps *md = &mdisps[i];
BLI_bitmap *gh = grid_hidden[i];
@@ -1325,7 +1325,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm)
md->hidden);
if (md->hidden)
MEM_freeN(md->hidden);
-
+
md->hidden = gh;
}
}
@@ -1342,10 +1342,10 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
MultiresModifierData *mmd = get_multires_modifier(NULL, ob, 1);
int *gridOffset, totlvl;
int i, k, numGrids, gridSize, dGridSize, dSkip;
-
+
if (!mmd)
return;
-
+
mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS);
if (!mdisps) {
@@ -1354,7 +1354,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
totlvl = mmd->totlvl;
ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple, false);
-
+
subsurf = subsurf_dm_create_local(ob, dm, totlvl,
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
@@ -1369,7 +1369,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
subGridData[i] = MEM_calloc_arrayN(key.elem_size, gridSize * gridSize, "subGridData");
memcpy(subGridData[i], gridData[i], key.elem_size * gridSize * gridSize);
}
-
+
/* numGrids = ccgdm->dm->getNumGrids((DerivedMesh *)ccgdm); */ /*UNUSED*/
gridSize = ccgdm->getGridSize((DerivedMesh *)ccgdm);
gridData = ccgdm->getGridData((DerivedMesh *)ccgdm);
@@ -1384,7 +1384,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
for (i = 0; i < dm->numPolyData; ++i) {
const int numVerts = mpoly[i].totloop;
int S, x, y, gIndex = gridOffset[i];
-
+
for (S = 0; S < numVerts; ++S, ++gIndex, ++k) {
MDisps *mdisp = &mdisps[mpoly[i].loopstart + S];
/* CCGElem *grid = gridData[gIndex]; */ /* UNUSED */
@@ -1405,7 +1405,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
float *data = dispgrid[dGridSize * y * dSkip + x * dSkip];
float *co = CCG_grid_elem_co(&key, subgrid, x, y);
float mat[3][3], dco[3];
-
+
/* construct tangent space matrix */
grid_tangent_matrix(mat, &key, x, y, subgrid);
@@ -1420,7 +1420,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
else if (from == MULTIRES_SPACE_ABSOLUTE) {
copy_v3_v3(dco, data);
}
-
+
/*now, convert to desired displacement type*/
if (to == MULTIRES_SPACE_TANGENT) {
invert_m3(mat);
@@ -1544,10 +1544,10 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u,
const int st_max = st - 1;
float urat, vrat, uopp;
float d[4][3], d2[2][3];
-
+
if (!disps || isnan(u) || isnan(v))
return;
-
+
if (u < 0)
u = 0;
else if (u >= st)
@@ -1564,7 +1564,7 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u,
if (x2 >= st) x2 = st_max;
if (y2 >= st) y2 = st_max;
-
+
urat = u - x;
vrat = v - y;
uopp = 1 - urat;
@@ -1639,7 +1639,7 @@ void multires_load_old_250(Mesh *me)
for (i = 0; i < me->totface; i++)
if (mdisps[i].totdisp)
old_mdisps_convert(&me->mface[i], &mdisps[i]);
-
+
CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop);
mdisps2 = CustomData_get_layer(&me->ldata, CD_MDISPS);
@@ -1648,7 +1648,7 @@ void multires_load_old_250(Mesh *me)
for (i = 0; i < me->totface; i++, mf++) {
int nvert = mf->v4 ? 4 : 3;
int totdisp = mdisps[i].totdisp / nvert;
-
+
for (j = 0; j < nvert; j++, k++) {
mdisps2[k].disps = MEM_calloc_arrayN(totdisp, 3 * sizeof(float), "multires disp in conversion");
mdisps2[k].totdisp = totdisp;
@@ -1709,11 +1709,11 @@ static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const Mult
{
int i, j;
IndexNode *node = NULL;
-
+
(*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert face map");
(*mem) = MEM_calloc_arrayN(totface, 4 * sizeof(IndexNode), "vert face map mem");
node = *mem;
-
+
/* Find the users */
for (i = 0; i < totface; ++i) {
for (j = 0; j < (mface[i].v[3] ? 4 : 3); ++j, ++node) {
@@ -1728,11 +1728,11 @@ static void create_old_vert_edge_map(ListBase **map, IndexNode **mem, const Mult
{
int i, j;
IndexNode *node = NULL;
-
+
(*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert edge map");
(*mem) = MEM_calloc_arrayN(totedge, 2 * sizeof(IndexNode), "vert edge map mem");
node = *mem;
-
+
/* Find the users */
for (i = 0; i < totedge; ++i) {
for (j = 0; j < 2; ++j, ++node) {
@@ -1853,7 +1853,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
vd = ccgSubSurf_getFaceCenterData(f);
copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co);
i++;
-
+
for (S = 0; S < numVerts; S++) {
for (x = 1; x < gridSize - 1; x++, i++) {
vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
@@ -2084,7 +2084,7 @@ static void multires_load_old_vcols(Mesh *me)
* so we can assume the active vcol layer is the correct one */
if (!(mcol = CustomData_get_layer(&me->fdata, CD_MCOL)))
return;
-
+
for (i = 0; i < me->totface; ++i) {
for (j = 0; j < 4; ++j) {
mcol[i * 4 + j].a = colface[i].col[j].a;
@@ -2163,7 +2163,7 @@ void multires_load_old(Object *ob, Mesh *me)
/* Add a multires modifier to the object */
md = ob->modifiers.first;
while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
- md = md->next;
+ md = md->next;
mmd = (MultiresModifierData *)modifier_new(eModifierType_Multires);
BLI_insertlinkbefore(&ob->modifiers, md, mmd);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 1db4e878c9a..f91d88a8a4a 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -79,31 +79,31 @@
void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip)
{
NlaStrip *cs, *csn;
-
+
/* sanity checks */
if (strip == NULL)
return;
-
+
/* free child-strips */
for (cs = strip->strips.first; cs; cs = csn) {
csn = cs->next;
BKE_nlastrip_free(&strip->strips, cs);
}
-
+
/* remove reference to action */
if (strip->act)
id_us_min(&strip->act->id);
-
+
/* free remapping info */
//if (strip->remap)
// BKE_animremap_free();
-
+
/* free own F-Curves */
free_fcurves(&strip->fcurves);
-
+
/* free own F-Modifiers */
free_fmodifiers(&strip->modifiers);
-
+
/* free the strip itself */
if (strips)
BLI_freelinkN(strips, strip);
@@ -117,17 +117,17 @@ void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip)
void BKE_nlatrack_free(ListBase *tracks, NlaTrack *nlt)
{
NlaStrip *strip, *stripn;
-
+
/* sanity checks */
if (nlt == NULL)
return;
-
+
/* free strips */
for (strip = nlt->strips.first; strip; strip = stripn) {
stripn = strip->next;
BKE_nlastrip_free(&nlt->strips, strip);
}
-
+
/* free NLA track itself now */
if (tracks)
BLI_freelinkN(tracks, nlt);
@@ -141,17 +141,17 @@ void BKE_nlatrack_free(ListBase *tracks, NlaTrack *nlt)
void BKE_nla_tracks_free(ListBase *tracks)
{
NlaTrack *nlt, *nltn;
-
+
/* sanity checks */
if (ELEM(NULL, tracks, tracks->first))
return;
-
+
/* free tracks one by one */
for (nlt = tracks->first; nlt; nlt = nltn) {
nltn = nlt->next;
BKE_nlatrack_free(tracks, nlt);
}
-
+
/* clear the list's pointers to be safe */
BLI_listbase_clear(tracks);
}
@@ -167,15 +167,15 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool use_same_ac
{
NlaStrip *strip_d;
NlaStrip *cs, *cs_d;
-
+
/* sanity check */
if (strip == NULL)
return NULL;
-
+
/* make a copy */
strip_d = MEM_dupallocN(strip);
strip_d->next = strip_d->prev = NULL;
-
+
/* handle action */
if (strip_d->act) {
if (use_same_action) {
@@ -187,19 +187,19 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool use_same_ac
strip_d->act = BKE_action_copy(bmain, strip_d->act);
}
}
-
+
/* copy F-Curves and modifiers */
copy_fcurves(&strip_d->fcurves, &strip->fcurves);
copy_fmodifiers(&strip_d->modifiers, &strip->modifiers);
-
+
/* make a copy of all the child-strips, one at a time */
BLI_listbase_clear(&strip_d->strips);
-
+
for (cs = strip->strips.first; cs; cs = cs->next) {
cs_d = BKE_nlastrip_copy(bmain, cs, use_same_action);
BLI_addtail(&strip_d->strips, cs_d);
}
-
+
/* return the strip */
return strip_d;
}
@@ -209,23 +209,23 @@ NlaTrack *BKE_nlatrack_copy(Main *bmain, NlaTrack *nlt, const bool use_same_acti
{
NlaStrip *strip, *strip_d;
NlaTrack *nlt_d;
-
+
/* sanity check */
if (nlt == NULL)
return NULL;
-
+
/* make a copy */
nlt_d = MEM_dupallocN(nlt);
nlt_d->next = nlt_d->prev = NULL;
-
+
/* make a copy of all the strips, one at a time */
BLI_listbase_clear(&nlt_d->strips);
-
+
for (strip = nlt->strips.first; strip; strip = strip->next) {
strip_d = BKE_nlastrip_copy(bmain, strip, use_same_actions);
BLI_addtail(&nlt_d->strips, strip_d);
}
-
+
/* return the copy */
return nlt_d;
}
@@ -234,14 +234,14 @@ NlaTrack *BKE_nlatrack_copy(Main *bmain, NlaTrack *nlt, const bool use_same_acti
void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src)
{
NlaTrack *nlt, *nlt_d;
-
+
/* sanity checks */
if (ELEM(NULL, dst, src))
return;
-
+
/* clear out the destination list first for precautions... */
BLI_listbase_clear(dst);
-
+
/* copy each NLA-track, one at a time */
for (nlt = src->first; nlt; nlt = nlt->next) {
/* make a copy, and add the copy to the destination list */
@@ -253,35 +253,35 @@ void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src)
/* Adding ------------------------------------------- */
-/* Add a NLA Track to the given AnimData
+/* Add a NLA Track to the given AnimData
* - prev: NLA-Track to add the new one after
*/
NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev)
{
NlaTrack *nlt;
-
+
/* sanity checks */
if (adt == NULL)
return NULL;
-
+
/* allocate new track */
nlt = MEM_callocN(sizeof(NlaTrack), "NlaTrack");
-
+
/* set settings requiring the track to not be part of the stack yet */
nlt->flag = NLATRACK_SELECTED;
nlt->index = BLI_listbase_count(&adt->nla_tracks);
-
+
/* add track to stack, and make it the active one */
if (prev)
BLI_insertlinkafter(&adt->nla_tracks, prev, nlt);
else
BLI_addtail(&adt->nla_tracks, nlt);
BKE_nlatrack_set_active(&adt->nla_tracks, nlt);
-
+
/* must have unique name, but we need to seed this */
strcpy(nlt->name, "NlaTrack");
BLI_uniquename(&adt->nla_tracks, nlt, DATA_("NlaTrack"), '.', offsetof(NlaTrack, name), sizeof(nlt->name));
-
+
/* return the new track */
return nlt;
}
@@ -290,15 +290,15 @@ NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev)
NlaStrip *BKE_nlastrip_new(bAction *act)
{
NlaStrip *strip;
-
+
/* sanity checks */
if (act == NULL)
return NULL;
-
+
/* allocate new strip */
strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
-
- /* generic settings
+
+ /* generic settings
* - selected flag to highlight this to the user
* - (XXX) disabled Auto-Blends, as this was often causing some unwanted effects
* - (XXX) synchronization of strip-length in accordance with changes to action-length
@@ -306,23 +306,23 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
* though this decision is still subject to further review...
*/
strip->flag = NLASTRIP_FLAG_SELECT;
-
+
/* assign the action reference */
strip->act = act;
id_us_plus(&act->id);
-
- /* determine initial range
+
+ /* determine initial range
* - strip length cannot be 0... ever...
*/
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
-
+
strip->start = strip->actstart;
strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f) : (strip->actend);
-
+
/* strip should be referenced as-is */
strip->scale = 1.0f;
strip->repeat = 1.0f;
-
+
/* return the new strip */
return strip;
}
@@ -332,28 +332,28 @@ NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act)
{
NlaStrip *strip;
NlaTrack *nlt;
-
+
/* sanity checks */
if (ELEM(NULL, adt, act))
return NULL;
-
+
/* create a new NLA strip */
strip = BKE_nlastrip_new(act);
if (strip == NULL)
return NULL;
-
+
/* firstly try adding strip to last track, but if that fails, add to a new track */
if (BKE_nlatrack_add_strip(adt->nla_tracks.last, strip) == 0) {
- /* trying to add to the last track failed (no track or no space),
+ /* trying to add to the last track failed (no track or no space),
* so add a new track to the stack, and add to that...
*/
nlt = BKE_nlatrack_add(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
-
+
/* automatically name it too */
BKE_nlastrip_validate_name(adt, strip);
-
+
/* returns the strip added */
return strip;
}
@@ -362,14 +362,14 @@ NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act)
NlaStrip *BKE_nla_add_soundstrip(Scene *scene, Speaker *speaker)
{
NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip");
-
+
/* if speaker has a sound, set the strip length to the length of the sound,
* otherwise default to length of 10 frames
*/
#ifdef WITH_AUDASPACE
if (speaker->sound) {
AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle);
-
+
strip->end = (float)ceil((double)info.length * FPS);
}
else
@@ -380,17 +380,17 @@ NlaStrip *BKE_nla_add_soundstrip(Scene *scene, Speaker *speaker)
(void)scene;
(void)speaker;
}
-
+
/* general settings */
strip->type = NLASTRIP_TYPE_SOUND;
-
+
strip->flag = NLASTRIP_FLAG_SELECT;
strip->extendmode = NLASTRIP_EXTEND_NOTHING; /* nothing to extend... */
-
+
/* strip should be referenced as-is */
strip->scale = 1.0f;
strip->repeat = 1.0f;
-
+
/* return this strip */
return strip;
}
@@ -407,19 +407,19 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
{
float actlength, scale;
// float repeat; // UNUSED
-
+
/* get number of repeats */
if (IS_EQF(strip->repeat, 0.0f)) strip->repeat = 1.0f;
// repeat = strip->repeat; // UNUSED
-
+
/* scaling */
if (IS_EQF(strip->scale, 0.0f)) strip->scale = 1.0f;
scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
-
+
/* length of referenced action */
actlength = strip->actend - strip->actstart;
if (IS_EQF(actlength, 0.0f)) actlength = 1.0f;
-
+
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
/* FIXME: this won't work right with Graph Editor? */
@@ -431,7 +431,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
}
else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* this case prevents the motion snapping back to the first frame at the end of the strip
+ /* this case prevents the motion snapping back to the first frame at the end of the strip
* by catching the case where repeats is a whole number, which means that the end of the strip
* could also be interpreted as the end of the start of a repeat
*/
@@ -454,7 +454,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
}
else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* this case prevents the motion snapping back to the first frame at the end of the strip
+ /* this case prevents the motion snapping back to the first frame at the end of the strip
* by catching the case where repeats is a whole number, which means that the end of the strip
* could also be interpreted as the end of the start of a repeat
*/
@@ -476,10 +476,10 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short mode)
{
float length;
-
+
/* length of strip */
length = strip->end - strip->start;
-
+
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
if (mode == NLATIME_CONVERT_MAP)
@@ -507,7 +507,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
case NLASTRIP_TYPE_META: /* meta - for now, does the same as transition (is really just an empty container) */
case NLASTRIP_TYPE_TRANSITION: /* transition */
return nlastrip_get_frame_transition(strip, cframe, mode);
-
+
case NLASTRIP_TYPE_CLIP: /* action-clip (default) */
default:
return nlastrip_get_frame_actionclip(strip, cframe, mode);
@@ -524,15 +524,15 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
{
NlaStrip *strip;
-
- /* sanity checks
+
+ /* sanity checks
* - obviously we've got to have some starting data
* - when not in tweakmode, the active Action does not have any scaling applied :)
* - when in tweakmode, if the no-mapping flag is set, do not map
*/
if ((adt == NULL) || (adt->flag & ADT_NLA_EDIT_ON) == 0 || (adt->flag & ADT_NLA_EDIT_NOMAP))
return cframe;
-
+
/* if the active-strip info has been stored already, access this, otherwise look this up
* and store for (very probable) future usage
*/
@@ -546,15 +546,15 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
adt->actstrip = BKE_nlastrip_find_active(adt->act_track);
}
strip = adt->actstrip;
-
- /* sanity checks
+
+ /* sanity checks
* - in rare cases, we may not be able to find this strip for some reason (internal error)
* - for now, if the user has defined a curve to control the time, this correction cannot be performed
* reliably...
*/
if ((strip == NULL) || (strip->flag & NLASTRIP_FLAG_USR_TIME))
return cframe;
-
+
/* perform the correction now... */
return nlastrip_get_frame(strip, cframe, mode);
}
@@ -569,7 +569,7 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
bool BKE_nlastrips_has_space(ListBase *strips, float start, float end)
{
NlaStrip *strip;
-
+
/* sanity checks */
if ((strips == NULL) || IS_EQF(start, end))
return false;
@@ -577,7 +577,7 @@ bool BKE_nlastrips_has_space(ListBase *strips, float start, float end)
puts("BKE_nlastrips_has_space() error... start and end arguments swapped");
SWAP(float, start, end);
}
-
+
/* loop over NLA strips checking for any overlaps with this area... */
for (strip = strips->first; strip; strip = strip->next) {
/* if start frame of strip is past the target end-frame, that means that
@@ -585,43 +585,43 @@ bool BKE_nlastrips_has_space(ListBase *strips, float start, float end)
*/
if (strip->start >= end)
return true;
-
+
/* if the end of the strip is greater than either of the boundaries, the range
* must fall within the extents of the strip
*/
if ((strip->end > start) || (strip->end > end))
return false;
}
-
+
/* if we are still here, we haven't encountered any overlapping strips */
return true;
}
-/* Rearrange the strips in the track so that they are always in order
+/* Rearrange the strips in the track so that they are always in order
* (usually only needed after a strip has been moved)
*/
void BKE_nlastrips_sort_strips(ListBase *strips)
{
ListBase tmp = {NULL, NULL};
NlaStrip *strip, *sstrip, *stripn;
-
+
/* sanity checks */
if (ELEM(NULL, strips, strips->first))
return;
-
+
/* we simply perform insertion sort on this list, since it is assumed that per track,
* there are only likely to be at most 5-10 strips
*/
for (strip = strips->first; strip; strip = stripn) {
short not_added = 1;
-
+
stripn = strip->next;
-
- /* remove this strip from the list, and add it to the new list, searching from the end of
- * the list, assuming that the lists are in order
+
+ /* remove this strip from the list, and add it to the new list, searching from the end of
+ * the list, assuming that the lists are in order
*/
BLI_remlink(strips, strip);
-
+
for (sstrip = tmp.last; sstrip; sstrip = sstrip->prev) {
/* check if add after */
if (sstrip->end <= strip->start) {
@@ -630,33 +630,33 @@ void BKE_nlastrips_sort_strips(ListBase *strips)
break;
}
}
-
+
/* add before first? */
if (not_added)
BLI_addhead(&tmp, strip);
}
-
+
/* reassign the start and end points of the strips */
strips->first = tmp.first;
strips->last = tmp.last;
}
-/* Add the given NLA-Strip to the given list of strips, assuming that it
+/* Add the given NLA-Strip to the given list of strips, assuming that it
* isn't currently a member of another list
*/
bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *ns;
bool not_added = true;
-
+
/* sanity checks */
if (ELEM(NULL, strips, strip))
return false;
-
+
/* check if any space to add */
if (BKE_nlastrips_has_space(strips, strip->start, strip->end) == 0)
return false;
-
+
/* find the right place to add the strip to the nominated track */
for (ns = strips->first; ns; ns = ns->next) {
/* if current strip occurs after the new strip, add it before */
@@ -670,7 +670,7 @@ bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
/* just add to the end of the list of the strips then... */
BLI_addtail(strips, strip);
}
-
+
/* added... */
return true;
}
@@ -686,15 +686,15 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
{
NlaStrip *mstrip = NULL;
NlaStrip *strip, *stripn;
-
+
/* sanity checks */
if (ELEM(NULL, strips, strips->first))
return;
-
+
/* group all continuous chains of selected strips into meta-strips */
for (strip = strips->first; strip; strip = stripn) {
stripn = strip->next;
-
+
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* if there is an existing meta-strip, add this strip to it, otherwise, create a new one */
if (mstrip == NULL) {
@@ -702,25 +702,25 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
mstrip = MEM_callocN(sizeof(NlaStrip), "Meta-NlaStrip");
mstrip->type = NLASTRIP_TYPE_META;
BLI_insertlinkbefore(strips, strip, mstrip);
-
+
/* set flags */
mstrip->flag = NLASTRIP_FLAG_SELECT;
-
+
/* set temp flag if appropriate (i.e. for transform-type editing) */
if (is_temp)
mstrip->flag |= NLASTRIP_FLAG_TEMP_META;
-
+
/* set default repeat/scale values to prevent warnings */
mstrip->repeat = mstrip->scale = 1.0f;
-
+
/* make its start frame be set to the start frame of the current strip */
mstrip->start = strip->start;
}
-
+
/* remove the selected strips from the track, and add to the meta */
BLI_remlink(strips, strip);
BLI_addtail(&mstrip->strips, strip);
-
+
/* expand the meta's dimensions to include the newly added strip- i.e. its last frame */
mstrip->end = strip->end;
}
@@ -737,11 +737,11 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *cs, *csn;
-
+
/* sanity check */
if (ELEM(NULL, strips, strip))
return;
-
+
/* move each one of the meta-strip's children before the meta-strip
* in the list of strips after unlinking them from the meta-strip
*/
@@ -750,7 +750,7 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
BLI_remlink(&strip->strips, cs);
BLI_insertlinkbefore(strips, strip, cs);
}
-
+
/* free the meta-strip now */
BKE_nlastrip_free(strips, strip);
}
@@ -762,15 +762,15 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp)
{
NlaStrip *strip, *stripn;
-
+
/* sanity checks */
if (ELEM(NULL, strips, strips->first))
return;
-
+
/* remove meta-strips fitting the criteria of the arguments */
for (strip = strips->first; strip; strip = stripn) {
stripn = strip->next;
-
+
/* check if strip is a meta-strip */
if (strip->type == NLASTRIP_TYPE_META) {
/* if check if selection and 'temporary-only' considerations are met */
@@ -791,37 +791,37 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
/* sanity checks */
if (ELEM(NULL, mstrip, strip))
return false;
-
+
/* firstly, check if the meta-strip has space for this */
if (BKE_nlastrips_has_space(&mstrip->strips, strip->start, strip->end) == 0)
return false;
-
+
/* check if this would need to be added to the ends of the meta,
* and subsequently, if the neighboring strips allow us enough room
*/
if (strip->start < mstrip->start) {
- /* check if strip to the left (if it exists) ends before the
- * start of the strip we're trying to add
+ /* check if strip to the left (if it exists) ends before the
+ * start of the strip we're trying to add
*/
if ((mstrip->prev == NULL) || (mstrip->prev->end <= strip->start)) {
/* add strip to start of meta's list, and expand dimensions */
BLI_addhead(&mstrip->strips, strip);
mstrip->start = strip->start;
-
+
return true;
}
else /* failed... no room before */
return false;
}
else if (strip->end > mstrip->end) {
- /* check if strip to the right (if it exists) starts before the
- * end of the strip we're trying to add
+ /* check if strip to the right (if it exists) starts before the
+ * end of the strip we're trying to add
*/
if ((mstrip->next == NULL) || (mstrip->next->start >= strip->end)) {
/* add strip to end of meta's list, and expand dimensions */
BLI_addtail(&mstrip->strips, strip);
mstrip->end = strip->end;
-
+
return true;
}
else /* failed... no room after */
@@ -833,7 +833,7 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
}
}
-/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively),
+/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively),
* until the Meta-Strips children all fit within the Meta-Strip's new dimensions
*/
void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
@@ -842,8 +842,8 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
float oStart, oEnd, offset;
float oLen, nLen;
short scaleChanged = 0;
-
- /* sanity checks
+
+ /* sanity checks
* - strip must exist
* - strip must be a meta-strip with some contents
*/
@@ -851,37 +851,37 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
return;
if (mstrip->type != NLASTRIP_TYPE_META)
return;
-
+
/* get the original start/end points, and calculate the start-frame offset
- * - these are simply the start/end frames of the child strips,
+ * - these are simply the start/end frames of the child strips,
* since we assume they weren't transformed yet
*/
oStart = ((NlaStrip *)mstrip->strips.first)->start;
oEnd = ((NlaStrip *)mstrip->strips.last)->end;
offset = mstrip->start - oStart;
-
+
/* optimization:
* don't flush if nothing changed yet
* TODO: maybe we need a flag to say always flush?
*/
if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end))
return;
-
+
/* check if scale changed */
oLen = oEnd - oStart;
nLen = mstrip->end - mstrip->start;
if (IS_EQF(nLen, oLen) == 0)
scaleChanged = 1;
-
+
/* for each child-strip, calculate new start/end points based on this new info */
for (strip = mstrip->strips.first; strip; strip = strip->next) {
if (scaleChanged) {
float p1, p2;
-
+
/* compute positions of endpoints relative to old extents of strip */
p1 = (strip->start - oStart) / oLen;
p2 = (strip->end - oStart) / oLen;
-
+
/* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */
strip->start = (p1 * nLen) + mstrip->start;
strip->end = (p2 * nLen) + mstrip->start;
@@ -892,20 +892,20 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
strip->end += offset;
}
}
-
+
/* apply a second pass over child strips, to finish up unfinished business */
for (strip = mstrip->strips.first; strip; strip = strip->next) {
/* only if scale changed, need to perform RNA updates */
if (scaleChanged) {
PointerRNA ptr;
-
+
/* use RNA updates to compute scale properly */
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr);
-
+
RNA_float_set(&ptr, "frame_start", strip->start);
RNA_float_set(&ptr, "frame_end", strip->end);
}
-
+
/* finally, make sure the strip's children (if it is a meta-itself), get updated */
BKE_nlameta_flush_transforms(strip);
}
@@ -917,17 +917,17 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
NlaTrack *BKE_nlatrack_find_active(ListBase *tracks)
{
NlaTrack *nlt;
-
+
/* sanity check */
if (ELEM(NULL, tracks, tracks->first))
return NULL;
-
+
/* try to find the first active track */
for (nlt = tracks->first; nlt; nlt = nlt->next) {
if (nlt->flag & NLATRACK_ACTIVE)
return nlt;
}
-
+
/* none found */
return NULL;
}
@@ -940,11 +940,11 @@ NlaTrack *BKE_nlatrack_find_active(ListBase *tracks)
NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt)
{
NlaTrack *nlt;
-
+
/* sanity check */
if (adt == NULL)
return NULL;
-
+
/* Since the track itself gets disabled, we want the first disabled... */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
if (nlt->flag & (NLATRACK_ACTIVE | NLATRACK_DISABLED)) {
@@ -954,13 +954,13 @@ NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt)
}
else if (G.debug & G_DEBUG) {
printf("%s: Active strip (%p, %s) not in NLA track found (%p, %s)\n",
- __func__,
+ __func__,
adt->actstrip, (adt->actstrip) ? adt->actstrip->name : "<None>",
nlt, nlt->name);
}
}
}
-
+
/* Not found! */
return NULL;
}
@@ -971,22 +971,22 @@ NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt)
void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt)
{
NlaTrack *nt;
-
+
/* sanity check */
if (ELEM(NULL, adt, adt->nla_tracks.first))
return;
-
+
/* firstly, make sure 'solo' flag for all tracks is disabled */
for (nt = adt->nla_tracks.first; nt; nt = nt->next) {
if (nt != nlt)
nt->flag &= ~NLATRACK_SOLO;
}
-
+
/* now, enable 'solo' for the given track if appropriate */
if (nlt) {
/* toggle solo status */
nlt->flag ^= NLATRACK_SOLO;
-
+
/* set or clear solo-status on AnimData */
if (nlt->flag & NLATRACK_SOLO)
adt->flag |= ADT_NLA_SOLO_TRACK;
@@ -997,21 +997,21 @@ void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt)
adt->flag &= ~ADT_NLA_SOLO_TRACK;
}
-/* Make the given NLA-track the active one for the given stack. If no track is provided,
+/* Make the given NLA-track the active one for the given stack. If no track is provided,
* this function can be used to simply deactivate all the NLA tracks in the given stack too.
*/
void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
{
NlaTrack *nlt;
-
+
/* sanity check */
if (ELEM(NULL, tracks, tracks->first))
return;
-
+
/* deactive all the rest */
for (nlt = tracks->first; nlt; nlt = nlt->next)
nlt->flag &= ~NLATRACK_ACTIVE;
-
+
/* set the given one as the active one */
if (nlt_a)
nlt_a->flag |= NLATRACK_ACTIVE;
@@ -1020,24 +1020,24 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
/* Check if there is any space in the given track to add a strip of the given length */
bool BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end)
{
- /* sanity checks
+ /* sanity checks
* - track must exist
* - track must be editable
* - bounds cannot be equal (0-length is nasty)
*/
if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQF(start, end))
return false;
-
+
if (start > end) {
puts("BKE_nlatrack_has_space() error... start and end arguments swapped");
SWAP(float, start, end);
}
-
+
/* check if there's any space left in the track for a strip of the given length */
return BKE_nlastrips_has_space(&nlt->strips, start, end);
}
-/* Rearrange the strips in the track so that they are always in order
+/* Rearrange the strips in the track so that they are always in order
* (usually only needed after a strip has been moved)
*/
void BKE_nlatrack_sort_strips(NlaTrack *nlt)
@@ -1045,12 +1045,12 @@ void BKE_nlatrack_sort_strips(NlaTrack *nlt)
/* sanity checks */
if (ELEM(NULL, nlt, nlt->strips.first))
return;
-
+
/* sort the strips with a more generic function */
BKE_nlastrips_sort_strips(&nlt->strips);
}
-/* Add the given NLA-Strip to the given NLA-Track, assuming that it
+/* Add the given NLA-Strip to the given NLA-Track, assuming that it
* isn't currently attached to another one
*/
bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
@@ -1058,11 +1058,11 @@ bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
/* sanity checks */
if (ELEM(NULL, nlt, strip))
return false;
-
+
/* do not allow adding strips if this track is locked */
if (nlt->flag & NLATRACK_PROTECTED)
return false;
-
+
/* try to add the strip to the track using a more generic function */
return BKE_nlastrips_add_strip(&nlt->strips, strip);
}
@@ -1073,25 +1073,25 @@ bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
{
NlaStrip *strip;
-
+
/* initialize bounds */
if (bounds)
bounds[0] = bounds[1] = 0.0f;
else
return false;
-
+
/* sanity checks */
if (ELEM(NULL, nlt, nlt->strips.first))
return false;
-
+
/* lower bound is first strip's start frame */
strip = nlt->strips.first;
bounds[0] = strip->start;
-
+
/* upper bound is last strip's end frame */
strip = nlt->strips.last;
bounds[1] = strip->end;
-
+
/* done */
return true;
}
@@ -1102,17 +1102,17 @@ bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
NlaStrip *BKE_nlastrip_find_active(NlaTrack *nlt)
{
NlaStrip *strip;
-
+
/* sanity check */
if (ELEM(NULL, nlt, nlt->strips.first))
return NULL;
-
+
/* try to find the first active strip */
for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_ACTIVE)
return strip;
}
-
+
/* none found */
return NULL;
}
@@ -1122,11 +1122,11 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
NlaStrip *nls;
-
+
/* sanity checks */
if (adt == NULL)
return;
-
+
/* loop over tracks, deactivating*/
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (nls = nlt->strips.first; nls; nls = nls->next) {
@@ -1144,11 +1144,11 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
{
const float stripLen = (strip) ? strip->end - strip->start : 0.0f;
const float boundsLen = fabsf(max - min);
-
+
/* sanity checks */
if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
return false;
-
+
/* only ok if at least part of the strip is within the bounding window
* - first 2 cases cover when the strip length is less than the bounding area
* - second 2 cases cover when the strip length is greater than the bounding area
@@ -1165,7 +1165,7 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
{
return false;
}
-
+
/* should be ok! */
return true;
}
@@ -1178,7 +1178,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
if (strip->next) {
NlaStrip *nls = strip->next;
float offset = 0.0f;
-
+
if (nls->type == NLASTRIP_TYPE_TRANSITION) {
/* transition strips should grow/shrink to accomodate the resized strip,
* but if the strip's bounds now exceed the transition, we're forced to
@@ -1198,7 +1198,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
*/
nls->start = nls->end - 1.0f;
offset = ceilf(strip->end - nls->start); /* XXX: review whether preventing fractionals is good here... */
-
+
/* apply necessary offset to ensure that the strip has enough space */
for (; nls; nls = nls->next) {
nls->start += offset;
@@ -1211,7 +1211,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
* otherwise it will be very hard to get rid of later
*/
offset = ceilf(strip->end - nls->start);
-
+
/* apply to times of all strips in this direction */
for (; nls; nls = nls->next) {
nls->start += offset;
@@ -1219,13 +1219,13 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
}
}
}
-
+
/* previous strips - same routine as before */
/* NOTE: when strip bounds are recalculated, this is not considered! */
if (strip->prev) {
NlaStrip *nls = strip->prev;
float offset = 0.0f;
-
+
if (nls->type == NLASTRIP_TYPE_TRANSITION) {
/* transition strips should grow/shrink to accomodate the resized strip,
* but if the strip's bounds now exceed the transition, we're forced to
@@ -1245,7 +1245,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
*/
nls->end = nls->start + 1.0f;
offset = ceilf(nls->end - strip->start); /* XXX: review whether preventing fractionals is good here... */
-
+
/* apply necessary offset to ensure that the strip has enough space */
for (; nls; nls = nls->next) {
nls->start -= offset;
@@ -1258,7 +1258,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
* otherwise it will be very hard to get rid of later
*/
offset = ceilf(nls->end - strip->start);
-
+
/* apply to times of all strips in this direction */
for (; nls; nls = nls->prev) {
nls->start -= offset;
@@ -1274,24 +1274,24 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
{
float actlen, mapping;
-
+
/* sanity checks
* - must have a strip
* - can only be done for action clips
*/
if ((strip == NULL) || (strip->type != NLASTRIP_TYPE_CLIP))
return;
-
+
/* calculate new length factors */
actlen = strip->actend - strip->actstart;
if (IS_EQF(actlen, 0.0f)) actlen = 1.0f;
-
+
mapping = strip->scale * strip->repeat;
-
+
/* adjust endpoint of strip in response to this */
if (IS_EQF(mapping, 0.0f) == 0)
strip->end = (actlen * mapping) + strip->start;
-
+
/* make sure we don't overlap our neighbors */
nlastrip_fix_resize_overlaps(strip);
}
@@ -1302,15 +1302,15 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
NlaStrip *ns;
-
+
/* sanity checks */
if (ELEM(NULL, adt, strip))
return false;
-
+
/* check if strip has any strips before it */
if (strip->prev)
return false;
-
+
/* check other tracks to see if they have a strip that's earlier */
/* TODO: or should we check that the strip's track is also the first? */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
@@ -1321,7 +1321,7 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip)
return false;
}
}
-
+
/* should be first now */
return true;
}
@@ -1332,17 +1332,17 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip)
bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
{
NlaStrip *strip;
-
+
/* sanity checks */
if (ELEM(NULL, nlt, nlt->strips.first))
return false;
-
+
/* check each strip for F-Curves only (don't care about whether the flags are set) */
for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->fcurves.first)
return true;
}
-
+
/* none found */
return false;
}
@@ -1351,17 +1351,17 @@ bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
bool BKE_nlatracks_have_animated_strips(ListBase *tracks)
{
NlaTrack *nlt;
-
+
/* sanity checks */
if (ELEM(NULL, tracks, tracks->first))
return false;
-
+
/* check each track, stopping on the first hit */
for (nlt = tracks->first; nlt; nlt = nlt->next) {
if (BKE_nlatrack_has_animated_strips(nlt))
return true;
}
-
+
/* none found */
return false;
}
@@ -1370,56 +1370,56 @@ bool BKE_nlatracks_have_animated_strips(ListBase *tracks)
void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
{
FCurve *fcu;
-
+
/* sanity checks */
if (strip == NULL)
return;
-
+
/* if controlling influence... */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
/* try to get F-Curve */
fcu = list_find_fcurve(&strip->fcurves, "influence", 0);
-
+
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
BLI_addtail(&strip->fcurves, fcu);
-
+
/* set default flags */
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
-
+
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("influence", 9);
-
+
/* insert keyframe to ensure current value stays on first refresh */
fcu->bezt = MEM_callocN(sizeof(BezTriple), "nlastrip influence bezt");
fcu->totvert = 1;
-
+
fcu->bezt->vec[1][0] = strip->start;
fcu->bezt->vec[1][1] = strip->influence;
}
}
-
+
/* if controlling time... */
if (strip->flag & NLASTRIP_FLAG_USR_TIME) {
/* try to get F-Curve */
fcu = list_find_fcurve(&strip->fcurves, "strip_time", 0);
-
+
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
BLI_addtail(&strip->fcurves, fcu);
-
+
/* set default flags */
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
-
+
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("strip_time", 10);
-
+
/* TODO: insert a few keyframes to ensure default behavior? */
}
}
@@ -1433,28 +1433,28 @@ bool BKE_nlastrip_has_curves_for_property(const PointerRNA *ptr, const PropertyR
/* sanity checks */
if (ELEM(NULL, ptr, prop))
return false;
-
+
/* 1) Must be NLA strip */
if (ptr->type == &RNA_NlaStrip) {
/* 2) Must be one of the predefined properties */
- static PropertyRNA *prop_influence = NULL;
+ static PropertyRNA *prop_influence = NULL;
static PropertyRNA *prop_time = NULL;
static bool needs_init = true;
-
+
/* Init the properties on first use */
if (needs_init) {
prop_influence = RNA_struct_type_find_property(&RNA_NlaStrip, "influence");
prop_time = RNA_struct_type_find_property(&RNA_NlaStrip, "strip_time");
-
+
needs_init = false;
}
-
+
/* Check if match */
if (ELEM(prop, prop_influence, prop_time)) {
return true;
}
}
-
+
/* No criteria met */
return false;
}
@@ -1466,7 +1466,7 @@ static bool nla_editbone_name_check(void *arg, const char *name)
return BLI_ghash_haskey((GHash *)arg, (const void *)name);
}
-/* Find (and set) a unique name for a strip from the whole AnimData block
+/* Find (and set) a unique name for a strip from the whole AnimData block
* Uses a similar method to the BLI method, but is implemented differently
* as we need to ensure that the name is unique over several lists of tracks,
* not just a single track.
@@ -1476,11 +1476,11 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
GHash *gh;
NlaStrip *tstrip;
NlaTrack *nlt;
-
+
/* sanity checks */
if (ELEM(NULL, adt, strip))
return;
-
+
/* give strip a default name if none already */
if (strip->name[0] == 0) {
switch (strip->type) {
@@ -1498,25 +1498,25 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
break;
}
}
-
- /* build a hash-table of all the strips in the tracks
+
+ /* build a hash-table of all the strips in the tracks
* - this is easier than iterating over all the tracks+strips hierarchy every time
* (and probably faster)
*/
gh = BLI_ghash_str_new("nlastrip_validate_name gh");
-
+
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (tstrip = nlt->strips.first; tstrip; tstrip = tstrip->next) {
/* don't add the strip of interest */
- if (tstrip == strip)
+ if (tstrip == strip)
continue;
-
+
/* use the name of the strip as the key, and the strip as the value, since we're mostly interested in the keys */
BLI_ghash_insert(gh, tstrip->name, tstrip);
}
}
-
- /* if the hash-table has a match for this name, try other names...
+
+ /* if the hash-table has a match for this name, try other names...
* - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :)
*/
BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, DATA_("NlaStrip"), '.', strip->name, sizeof(strip->name));
@@ -1527,7 +1527,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
/* ---- */
-/* Get strips which overlap the given one at the start/end of its range
+/* Get strips which overlap the given one at the start/end of its range
* - strip: strip that we're finding overlaps for
* - track: nla-track that the overlapping strips should be found from
* - start, end: frames for the offending endpoints
@@ -1535,9 +1535,9 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, float **start, float **end)
{
NlaStrip *nls;
-
+
/* find strips that overlap over the start/end of the given strip,
- * but which don't cover the entire length
+ * but which don't cover the entire length
*/
/* TODO: this scheme could get quite slow for doing this on many strips... */
for (nls = track->strips.first; nls; nls = nls->next) {
@@ -1547,13 +1547,13 @@ static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, flo
*end = NULL;
return;
}
-
+
/* check if strip doesn't even occur anywhere near... */
if (nls->end < strip->start)
continue; /* skip checking this strip... not worthy of mention */
if (nls->start > strip->end)
return; /* the range we're after has already passed */
-
+
/* if this strip is not part of an island of continuous strips, it can be used
* - this check needs to be done for each end of the strip we try and use...
*/
@@ -1573,7 +1573,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
{
float *ps = NULL, *pe = NULL;
float *ns = NULL, *ne = NULL;
-
+
/* sanity checks */
if (ELEM(NULL, nls, nlt))
return;
@@ -1581,16 +1581,16 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
return;
if ((nls->flag & NLASTRIP_FLAG_AUTO_BLENDS) == 0)
return;
-
+
/* get test ranges */
if (nlt->prev)
nlastrip_get_endpoint_overlaps(nls, nlt->prev, &ps, &pe);
if (nlt->next)
nlastrip_get_endpoint_overlaps(nls, nlt->next, &ns, &ne);
-
- /* set overlaps for this strip
- * - don't use the values obtained though if the end in question
- * is directly followed/preceded by another strip, forming an
+
+ /* set overlaps for this strip
+ * - don't use the values obtained though if the end in question
+ * is directly followed/preceded by another strip, forming an
* 'island' of continuous strips
*/
if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) {
@@ -1602,7 +1602,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
}
else /* no overlap allowed/needed */
nls->blendin = 0.0f;
-
+
if ((pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end) == 0)) {
/* end overlaps - pick the largest overlap */
if ( ((pe && ne) && (*pe > *ne)) || (pe) )
@@ -1619,33 +1619,33 @@ void BKE_nla_validate_state(AnimData *adt)
{
NlaStrip *strip, *fstrip = NULL;
NlaTrack *nlt;
-
+
/* sanity checks */
if (ELEM(NULL, adt, adt->nla_tracks.first))
return;
-
+
/* adjust blending values for auto-blending, and also do an initial pass to find the earliest strip */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* auto-blending first */
BKE_nlastrip_validate_autoblends(nlt, strip);
-
+
/* extend mode - find first strip */
if ((fstrip == NULL) || (strip->start < fstrip->start))
fstrip = strip;
}
}
-
+
/* second pass over the strips to adjust the extend-mode to fix any problems */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
- /* apart from 'nothing' option which user has to explicitly choose, we don't really know if
+ /* apart from 'nothing' option which user has to explicitly choose, we don't really know if
* we should be overwriting the extend setting (but assume that's what the user wanted)
*/
/* TODO: 1 solution is to tie this in with auto-blending... */
if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
/* 1) First strip must be set to extend hold, otherwise, stuff before acts dodgy
- * 2) Only overwrite extend mode if *not* changing it will most probably result in
+ * 2) Only overwrite extend mode if *not* changing it will most probably result in
* occlusion problems, which will occur if...
* - blendmode = REPLACE
* - all channels the same (this is fiddly to test, so is currently assumed)
@@ -1676,7 +1676,7 @@ bool BKE_nla_action_is_stashed(AnimData *adt, bAction *act)
{
NlaTrack *nlt;
NlaStrip *strip;
-
+
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
if (strstr(nlt->name, STASH_TRACK_NAME)) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
@@ -1685,7 +1685,7 @@ bool BKE_nla_action_is_stashed(AnimData *adt, bAction *act)
}
}
}
-
+
return false;
}
@@ -1697,60 +1697,60 @@ bool BKE_nla_action_stash(AnimData *adt)
NlaTrack *prev_track = NULL;
NlaTrack *nlt;
NlaStrip *strip;
-
+
/* sanity check */
if (ELEM(NULL, adt, adt->action)) {
printf("%s: Invalid argument - %p %p\n", __func__, adt, adt->action);
return false;
}
-
+
/* do not add if it is already stashed */
if (BKE_nla_action_is_stashed(adt, adt->action))
return false;
-
+
/* create a new track, and add this immediately above the previous stashing track */
for (prev_track = adt->nla_tracks.last; prev_track; prev_track = prev_track->prev) {
if (strstr(prev_track->name, STASH_TRACK_NAME)) {
break;
}
}
-
+
nlt = BKE_nlatrack_add(adt, prev_track);
BLI_assert(nlt != NULL);
-
+
/* we need to ensure that if there wasn't any previous instance, it must go to tbe bottom of the stack */
if (prev_track == NULL) {
BLI_remlink(&adt->nla_tracks, nlt);
BLI_addhead(&adt->nla_tracks, nlt);
}
-
+
BLI_strncpy(nlt->name, STASH_TRACK_NAME, sizeof(nlt->name));
BLI_uniquename(&adt->nla_tracks, nlt, STASH_TRACK_NAME, '.', offsetof(NlaTrack, name), sizeof(nlt->name));
-
+
/* add the action as a strip in this new track
* NOTE: a new user is created here
*/
strip = BKE_nlastrip_new(adt->action);
BLI_assert(strip != NULL);
-
+
BKE_nlatrack_add_strip(nlt, strip);
BKE_nlastrip_validate_name(adt, strip);
-
+
/* mark the stash track and strip so that they doesn't disturb the stack animation,
* and are unlikely to draw attention to itself (or be accidentally bumped around)
- *
+ *
* NOTE: this must be done *after* adding the strip to the track, or else
* the strip locking will prevent the strip from getting added
*/
nlt->flag = (NLATRACK_MUTED | NLATRACK_PROTECTED);
strip->flag &= ~(NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
-
+
/* also mark the strip for auto syncing the length, so that the strips accurately
* reflect the length of the action
* XXX: we could do with some extra flags here to prevent repeats/scaling options from working!
*/
strip->flag |= NLASTRIP_FLAG_SYNC_LENGTH;
-
+
/* succeeded */
return true;
}
@@ -1767,7 +1767,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
{
NlaStrip *strip;
const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
-
+
/* sanity checks */
/* TODO: need to report the error for this */
if (ELEM(NULL, adt, adt->action))
@@ -1781,16 +1781,16 @@ void BKE_nla_action_pushdown(AnimData *adt)
printf("BKE_nla_action_pushdown(): action has no data\n");
return;
}
-
+
/* add a new NLA strip to the track, which references the active action */
strip = BKE_nlastack_add_strip(adt, adt->action);
-
+
/* do other necessary work on strip */
if (strip) {
/* clear reference to action now that we've pushed it onto the stack */
id_us_min(&adt->action->id);
adt->action = NULL;
-
+
/* copy current "action blending" settings from adt to the strip,
* as it was keyframed with these settings, so omitting them will
* change the effect [T54233]
@@ -1801,7 +1801,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
strip->blendmode = adt->act_blendmode;
strip->influence = adt->act_influence;
strip->extendmode = adt->act_extendmode;
-
+
if (adt->act_influence < 1.0f) {
/* enable "user-controlled" influence (which will insert a default keyframe)
* so that the influence doesn't get lost on the new update
@@ -1816,7 +1816,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
BKE_nlastrip_validate_fcurves(strip);
}
}
-
+
/* if the strip is the first one in the track it lives in, check if there
* are strips in any other tracks that may be before this, and set the extend
* mode accordingly
@@ -1829,7 +1829,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
if (strip->extendmode == NLASTRIP_EXTEND_HOLD)
strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD;
}
-
+
/* make strip the active one... */
BKE_nlastrip_set_active(adt, strip);
}
@@ -1842,17 +1842,17 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
{
NlaTrack *nlt, *activeTrack = NULL;
NlaStrip *strip, *activeStrip = NULL;
-
+
/* verify that data is valid */
if (ELEM(NULL, adt, adt->nla_tracks.first))
return false;
-
- /* if block is already in tweakmode, just leave, but we should report
+
+ /* if block is already in tweakmode, just leave, but we should report
* that this block is in tweakmode (as our returncode)
*/
if (adt->flag & ADT_NLA_EDIT_ON)
return true;
-
+
/* go over the tracks, finding the active one, and its active strip
* - if we cannot find both, then there's nothing to do
*/
@@ -1861,16 +1861,16 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
if (nlt->flag & NLATRACK_ACTIVE) {
/* store reference to this active track */
activeTrack = nlt;
-
+
/* now try to find active strip */
activeStrip = BKE_nlastrip_find_active(nlt);
break;
}
}
-
- /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all
- * of those at once. Usually in those cases, it will usually just be a single strip per AnimData.
- * In such cases, compromise and take the last selected track and/or last selected strip [#28468]
+
+ /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all
+ * of those at once. Usually in those cases, it will usually just be a single strip per AnimData.
+ * In such cases, compromise and take the last selected track and/or last selected strip [#28468]
*/
if (activeTrack == NULL) {
/* try last selected track for active strip */
@@ -1878,7 +1878,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
if (nlt->flag & NLATRACK_SELECTED) {
/* assume this is the active track */
activeTrack = nlt;
-
+
/* try to find active strip */
activeStrip = BKE_nlastrip_find_active(nlt);
break;
@@ -1894,7 +1894,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
}
}
-
+
if (ELEM(NULL, activeTrack, activeStrip, activeStrip->act)) {
if (G.debug & G_DEBUG) {
printf("NLA tweakmode enter - neither active requirement found\n");
@@ -1902,8 +1902,8 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
return false;
}
-
- /* go over all the tracks up to the active one, tagging each strip that uses the same
+
+ /* go over all the tracks up to the active one, tagging each strip that uses the same
* action as the active strip, but leaving everything else alone
*/
for (nlt = activeTrack->prev; nlt; nlt = nlt->prev) {
@@ -1914,7 +1914,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
}
}
-
+
/* tag all other strips in active track that uses the same action as the active strip */
for (strip = activeTrack->strips.first; strip; strip = strip->next) {
if ((strip->act == activeStrip->act) && (strip != activeStrip))
@@ -1922,13 +1922,13 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
else
strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
}
-
- /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled
+
+ /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled
* - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on
*/
for (nlt = activeTrack; nlt; nlt = nlt->next)
nlt->flag |= NLATRACK_DISABLED;
-
+
/* handle AnimData level changes:
* - 'real' active action to temp storage (no need to change user-counts)
* - action of active strip set to be the 'active action', and have its usercount incremented
@@ -1941,7 +1941,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
adt->actstrip = activeStrip;
id_us_plus(&activeStrip->act->id);
adt->flag |= ADT_NLA_EDIT_ON;
-
+
/* done! */
return true;
}
@@ -1951,27 +1951,27 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
{
NlaStrip *strip;
NlaTrack *nlt;
-
+
/* verify that data is valid */
if (ELEM(NULL, adt, adt->nla_tracks.first))
return;
-
+
/* hopefully the flag is correct - skip if not on */
if ((adt->flag & ADT_NLA_EDIT_ON) == 0)
return;
-
+
/* sync the length of the user-strip with the new state of the action
* but only if the user has explicitly asked for this to happen
* (see [#34645] for things to be careful about)
*/
if ((adt->actstrip) && (adt->actstrip->flag & NLASTRIP_FLAG_SYNC_LENGTH)) {
strip = adt->actstrip;
-
+
/* must be action-clip only (transitions don't have scale) */
if ((strip->type == NLASTRIP_TYPE_CLIP) && (strip->act)) {
/* recalculate the length of the action */
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
-
+
/* adjust the strip extents in response to this */
BKE_nlastrip_recalculate_bounds(strip);
}
@@ -1982,22 +1982,22 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
*/
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
nlt->flag &= ~NLATRACK_DISABLED;
-
+
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* sync strip extents if this strip uses the same action */
if ((adt->actstrip) && (adt->actstrip->act == strip->act) && (strip->flag & NLASTRIP_FLAG_SYNC_LENGTH)) {
/* recalculate the length of the action */
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
-
+
/* adjust the strip extents in response to this */
BKE_nlastrip_recalculate_bounds(strip);
}
-
+
/* clear tweakuser flag */
strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
}
}
-
+
/* handle AnimData level changes:
* - 'temporary' active action needs its usercount decreased, since we're removing this reference
* - 'real' active action is restored from storage
@@ -2019,23 +2019,23 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
{
- /* verify that data is valid
- * 1) Scene and AnimData must be provided
+ /* verify that data is valid
+ * 1) Scene and AnimData must be provided
* 2) there must be tracks to merge...
*/
if (ELEM(NULL, scene, adt, adt->nla_tracks.first))
return;
-
+
/* if animdata currently has an action, 'push down' this onto the stack first */
if (adt->action)
BKE_nla_action_pushdown(adt);
-
+
/* get range of motion to bake, and the channels involved... */
-
+
/* temporarily mute the action, and start keying to it */
-
+
/* start keying... */
-
+
/* unmute the action */
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 2bebdff10a6..b90e2d70e05 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -92,7 +92,7 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType
sockdef = ntype->inputs;
while (sockdef->type != -1) {
/* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_IN);
-
+
sockdef++;
}
}
@@ -100,7 +100,7 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType
sockdef = ntype->outputs;
while (sockdef->type != -1) {
/* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_OUT);
-
+
sockdef++;
}
}
@@ -115,11 +115,11 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
bNodeType *ntype = node->typeinfo;
if (ntype == &NodeTypeUndefined)
return;
-
+
/* only do this once */
if (node->flag & NODE_INIT)
return;
-
+
node->flag = NODE_SELECT | NODE_OPTIONS | ntype->flag;
node->width = ntype->width;
node->miniwidth = 42.0f;
@@ -134,7 +134,7 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
* than adding "do_translate" flags to this func (and labelfunc() as well). */
BLI_strncpy(node->name, DATA_(ntype->ui_name), NODE_MAXSTR);
nodeUniqueName(ntree, node);
-
+
node_add_sockets_from_type(ntree, node, ntype);
if (ntype->initfunc != NULL)
@@ -147,17 +147,17 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
if (ntype->initfunc_api) {
PointerRNA ptr;
RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
-
+
/* XXX Warning: context can be NULL in case nodes are added in do_versions.
* Delayed init is not supported for nodes with context-based initfunc_api atm.
*/
BLI_assert(C != NULL);
ntype->initfunc_api(C, &ptr);
}
-
+
if (node->id)
id_us_plus(node->id);
-
+
node->flag |= NODE_INIT;
}
@@ -165,13 +165,13 @@ static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo)
{
if (typeinfo) {
ntree->typeinfo = typeinfo;
-
+
/* deprecated integer type */
ntree->type = typeinfo->type;
}
else {
ntree->typeinfo = &NodeTreeTypeUndefined;
-
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
@@ -183,19 +183,19 @@ static void node_set_typeinfo(const struct bContext *C, bNodeTree *ntree, bNode
if (typeinfo && typeinfo->storagename[0] && !node->storage)
typeinfo = NULL;
}
-
+
if (typeinfo) {
node->typeinfo = typeinfo;
-
+
/* deprecated integer type */
node->type = typeinfo->type;
-
+
/* initialize the node if necessary */
node_init(C, ntree, node);
}
else {
node->typeinfo = &NodeTypeUndefined;
-
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
@@ -204,10 +204,10 @@ static void node_socket_set_typeinfo(bNodeTree *ntree, bNodeSocket *sock, bNodeS
{
if (typeinfo) {
sock->typeinfo = typeinfo;
-
+
/* deprecated integer type */
sock->type = typeinfo->type;
-
+
if (sock->default_value == NULL) {
/* initialize the default_value pointer used by standard socket types */
node_socket_init_default_value(sock);
@@ -215,7 +215,7 @@ static void node_socket_set_typeinfo(bNodeTree *ntree, bNodeSocket *sock, bNodeS
}
else {
sock->typeinfo = &NodeSocketTypeUndefined;
-
+
ntree->init &= ~NTREE_TYPE_INIT;
}
}
@@ -225,21 +225,21 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType
{
if (!bmain)
return;
-
+
FOREACH_NODETREE(bmain, ntree, id) {
bNode *node;
bNodeSocket *sock;
-
+
ntree->init |= NTREE_TYPE_INIT;
-
+
if (treetype && STREQ(ntree->idname, treetype->idname))
ntree_set_typeinfo(ntree, unregister ? NULL : treetype);
-
+
/* initialize nodes */
for (node = ntree->nodes.first; node; node = node->next) {
if (nodetype && STREQ(node->idname, nodetype->idname))
node_set_typeinfo(C, ntree, node, unregister ? NULL : nodetype);
-
+
/* initialize node sockets */
for (sock = node->inputs.first; sock; sock = sock->next)
if (socktype && STREQ(sock->idname, socktype->idname))
@@ -248,7 +248,7 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType
if (socktype && STREQ(sock->idname, socktype->idname))
node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
}
-
+
/* initialize tree sockets */
for (sock = ntree->inputs.first; sock; sock = sock->next)
if (socktype && STREQ(sock->idname, socktype->idname))
@@ -269,20 +269,20 @@ void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree)
{
bNode *node;
bNodeSocket *sock;
-
+
ntree->init |= NTREE_TYPE_INIT;
-
+
ntree_set_typeinfo(ntree, ntreeTypeFind(ntree->idname));
-
+
for (node = ntree->nodes.first; node; node = node->next) {
node_set_typeinfo(C, ntree, node, nodeTypeFind(node->idname));
-
+
for (sock = node->inputs.first; sock; sock = sock->next)
node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
for (sock = node->outputs.first; sock; sock = sock->next)
node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
}
-
+
for (sock = ntree->inputs.first; sock; sock = sock->next)
node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
for (sock = ntree->outputs.first; sock; sock = sock->next)
@@ -370,11 +370,11 @@ static void node_free_type(void *nodetype_v)
bNodeType *nodetype = nodetype_v;
/* XXX pass Main to unregister function? */
update_typeinfo(G.main, NULL, NULL, nodetype, NULL, true);
-
+
/* XXX deprecated */
if (nodetype->type == NODE_DYNAMIC)
free_dynamic_typeinfo(nodetype);
-
+
if (nodetype->needs_free)
MEM_freeN(nodetype);
}
@@ -384,7 +384,7 @@ void nodeRegisterType(bNodeType *nt)
/* debug only: basic verification of registered types */
BLI_assert(nt->idname[0] != '\0');
BLI_assert(nt->poll != NULL);
-
+
BLI_ghash_insert(nodetypes_hash, nt->idname, nt);
/* XXX pass Main to register function? */
update_typeinfo(G.main, NULL, NULL, nt, NULL, false);
@@ -424,7 +424,7 @@ static void node_free_socket_type(void *socktype_v)
bNodeSocketType *socktype = socktype_v;
/* XXX pass Main to unregister function? */
update_typeinfo(G.main, NULL, NULL, NULL, socktype, true);
-
+
MEM_freeN(socktype);
}
@@ -477,7 +477,7 @@ static bNodeSocket *make_socket(bNodeTree *ntree, bNode *UNUSED(node), int in_ou
{
bNodeSocket *sock;
char auto_identifier[MAX_NAME];
-
+
if (identifier && identifier[0] != '\0') {
/* use explicit identifier */
BLI_strncpy(auto_identifier, identifier, sizeof(auto_identifier));
@@ -488,21 +488,21 @@ static bNodeSocket *make_socket(bNodeTree *ntree, bNode *UNUSED(node), int in_ou
}
/* make the identifier unique */
BLI_uniquename_cb(unique_identifier_check, lb, "socket", '.', auto_identifier, sizeof(auto_identifier));
-
+
sock = MEM_callocN(sizeof(bNodeSocket), "sock");
sock->in_out = in_out;
-
+
BLI_strncpy(sock->identifier, auto_identifier, NODE_MAXSTR);
sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
-
+
BLI_strncpy(sock->name, name, NODE_MAXSTR);
sock->storage = NULL;
sock->flag |= SOCK_COLLAPSED;
sock->type = SOCK_CUSTOM; /* int type undefined by default */
-
+
BLI_strncpy(sock->idname, idname, sizeof(sock->idname));
node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(idname));
-
+
return sock;
}
@@ -531,12 +531,12 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char
{
ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs);
bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name);
-
+
BLI_remlink(lb, sock); /* does nothing for new socket */
BLI_addtail(lb, sock);
-
+
node->update |= NODE_UPDATE;
-
+
return sock;
}
@@ -545,12 +545,12 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, const c
{
ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs);
bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name);
-
+
BLI_remlink(lb, sock); /* does nothing for new socket */
BLI_insertlinkbefore(lb, next_sock, sock);
-
+
node->update |= NODE_UPDATE;
-
+
return sock;
}
@@ -681,12 +681,12 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, bNode *node, int in_out, int
{
const char *idname = nodeStaticSocketType(type, subtype);
bNodeSocket *sock;
-
+
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
return NULL;
}
-
+
sock = nodeAddSocket(ntree, node, in_out, idname, identifier, name);
sock->type = type;
return sock;
@@ -697,12 +697,12 @@ bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, bNode *node, int in_out, i
{
const char *idname = nodeStaticSocketType(type, subtype);
bNodeSocket *sock;
-
+
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
return NULL;
}
-
+
sock = nodeInsertSocket(ntree, node, in_out, idname, next_sock, identifier, name);
sock->type = type;
return sock;
@@ -714,7 +714,7 @@ static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode
IDP_FreeProperty(sock->prop);
MEM_freeN(sock->prop);
}
-
+
if (sock->default_value)
MEM_freeN(sock->default_value);
}
@@ -722,21 +722,21 @@ static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode
void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
{
bNodeLink *link, *next;
-
+
for (link = ntree->links.first; link; link = next) {
next = link->next;
if (link->fromsock == sock || link->tosock == sock) {
nodeRemLink(ntree, link);
}
}
-
+
/* this is fast, this way we don't need an in_out argument */
BLI_remlink(&node->inputs, sock);
BLI_remlink(&node->outputs, sock);
-
+
node_socket_free(ntree, sock, node);
MEM_freeN(sock);
-
+
node->update |= NODE_UPDATE;
}
@@ -744,14 +744,14 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock, *sock_next;
bNodeLink *link, *next;
-
+
for (link = ntree->links.first; link; link = next) {
next = link->next;
if (link->fromnode == node || link->tonode == node) {
nodeRemLink(ntree, link);
}
}
-
+
for (sock = node->inputs.first; sock; sock = sock_next) {
sock_next = sock->next;
node_socket_free(ntree, sock, node);
@@ -765,7 +765,7 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
MEM_freeN(sock);
}
BLI_listbase_clear(&node->outputs);
-
+
node->update |= NODE_UPDATE;
}
@@ -782,7 +782,7 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin
bNode *node;
bNodeSocket *tsock;
int index = 0;
-
+
for (node = ntree->nodes.first; node; node = node->next) {
tsock = (in_out == SOCK_IN ? node->inputs.first : node->outputs.first);
for (index = 0; tsock; tsock = tsock->next, index++) {
@@ -798,7 +798,7 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin
if (sockindex) *sockindex = index;
return 1;
}
-
+
*nodep = NULL;
return 0;
}
@@ -890,22 +890,22 @@ void nodeUniqueName(bNodeTree *ntree, bNode *node)
bNode *nodeAddNode(const struct bContext *C, bNodeTree *ntree, const char *idname)
{
bNode *node;
-
+
node = MEM_callocN(sizeof(bNode), "new node");
BLI_addtail(&ntree->nodes, node);
-
+
BLI_strncpy(node->idname, idname, sizeof(node->idname));
node_set_typeinfo(C, ntree, node, nodeTypeFind(idname));
-
+
ntree->update |= NTREE_UPDATE_NODES;
-
+
return node;
}
bNode *nodeAddStaticNode(const struct bContext *C, bNodeTree *ntree, int type)
{
const char *idname = NULL;
-
+
NODE_TYPES_BEGIN(ntype)
/* do an extra poll here, because some int types are used
* for multiple node types, this helps find the desired type
@@ -1022,11 +1022,11 @@ bNode *nodeCopyNode(bNodeTree *ntree, bNode *node)
bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
{
bNodeLink *link = NULL;
-
+
/* test valid input */
BLI_assert(fromnode);
BLI_assert(tonode);
-
+
if (fromsock->in_out == SOCK_OUT && tosock->in_out == SOCK_IN) {
link = MEM_callocN(sizeof(bNodeLink), "link");
if (ntree)
@@ -1046,10 +1046,10 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
link->tonode = fromnode;
link->tosock = fromsock;
}
-
+
if (ntree)
ntree->update |= NTREE_UPDATE_LINKS;
-
+
return link;
}
@@ -1062,7 +1062,7 @@ void nodeRemLink(bNodeTree *ntree, bNodeLink *link)
if (link->tosock)
link->tosock->link = NULL;
MEM_freeN(link);
-
+
if (ntree)
ntree->update |= NTREE_UPDATE_LINKS;
}
@@ -1070,14 +1070,14 @@ void nodeRemLink(bNodeTree *ntree, bNodeLink *link)
void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
{
bNodeLink *link, *next;
-
+
for (link = ntree->links.first; link; link = next) {
next = link->next;
if (link->fromsock == sock || link->tosock == sock) {
nodeRemLink(ntree, link);
}
}
-
+
ntree->update |= NTREE_UPDATE_LINKS;
}
@@ -1089,15 +1089,15 @@ bool nodeLinkIsHidden(bNodeLink *link)
void nodeInternalRelink(bNodeTree *ntree, bNode *node)
{
bNodeLink *link, *link_next;
-
+
/* store link pointers in output sockets, for efficient lookup */
for (link = node->internal_links.first; link; link = link->next)
link->tosock->link = link;
-
+
/* redirect downstream links */
for (link = ntree->links.first; link; link = link_next) {
link_next = link->next;
-
+
/* do we have internal link? */
if (link->fromnode == node) {
if (link->fromsock->link) {
@@ -1107,13 +1107,13 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node)
if (fromlink) {
link->fromnode = fromlink->fromnode;
link->fromsock = fromlink->fromsock;
-
+
/* if the up- or downstream link is invalid,
* the replacement link will be invalid too.
*/
if (!(fromlink->flag & NODE_LINK_VALID))
link->flag &= ~NODE_LINK_VALID;
-
+
ntree->update |= NTREE_UPDATE_LINKS;
}
else
@@ -1123,11 +1123,11 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node)
nodeRemLink(ntree, link);
}
}
-
+
/* remove remaining upstream links */
for (link = ntree->links.first; link; link = link_next) {
link_next = link->next;
-
+
if (link->tonode == node)
nodeRemLink(ntree, link);
}
@@ -1177,7 +1177,7 @@ void nodeAttachNode(bNode *node, bNode *parent)
BLI_assert(nodeAttachNodeCheck(parent, node) == false);
nodeToView(node, 0.0f, 0.0f, &locx, &locy);
-
+
node->parent = parent;
/* transform to parent space */
nodeFromView(parent, locx, locy, &node->locx, &node->locy);
@@ -1186,7 +1186,7 @@ void nodeAttachNode(bNode *node, bNode *parent)
void nodeDetachNode(struct bNode *node)
{
float locx, locy;
-
+
if (node->parent) {
BLI_assert(node->parent->type == NODE_FRAME);
@@ -1207,7 +1207,7 @@ void ntreeInitDefault(bNodeTree *ntree)
bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
{
bNodeTree *ntree;
-
+
/* trees are created as local trees for compositor, material or texture nodes,
* node groups and other tree types are created as library data.
*/
@@ -1219,15 +1219,15 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
*( (short *)ntree->id.name ) = ID_NT;
BLI_strncpy(ntree->id.name + 2, name, sizeof(ntree->id.name));
}
-
+
/* Types are fully initialized at this point,
* if an undefined node is added later this will be reset.
*/
ntree->init |= NTREE_TYPE_INIT;
-
+
BLI_strncpy(ntree->idname, idname, sizeof(ntree->idname));
ntree_set_typeinfo(ntree, ntreeTypeFind(idname));
-
+
return ntree;
}
@@ -1358,7 +1358,7 @@ int BKE_node_preview_used(bNode *node)
bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create)
{
bNodePreview *preview;
-
+
preview = BKE_node_instance_hash_lookup(previews, key);
if (!preview) {
if (create) {
@@ -1368,11 +1368,11 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstance
else
return NULL;
}
-
+
/* node previews can get added with variable size this way */
if (xsize == 0 || ysize == 0)
return preview;
-
+
/* sanity checks & initialize */
if (preview->rect) {
if (preview->xsize != xsize || preview->ysize != ysize) {
@@ -1380,14 +1380,14 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstance
preview->rect = NULL;
}
}
-
+
if (preview->rect == NULL) {
preview->rect = MEM_callocN(4 * xsize + xsize * ysize * sizeof(char) * 4, "node preview rect");
preview->xsize = xsize;
preview->ysize = ysize;
}
/* no clear, makes nicer previews */
-
+
return preview;
}
@@ -1411,14 +1411,14 @@ static void node_preview_init_tree_recursive(bNodeInstanceHash *previews, bNodeT
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node);
-
+
if (BKE_node_preview_used(node)) {
node->preview_xsize = xsize;
node->preview_ysize = ysize;
-
+
BKE_node_preview_verify(previews, key, xsize, ysize, create);
}
-
+
if (node->type == NODE_GROUP && node->id)
node_preview_init_tree_recursive(previews, (bNodeTree *)node->id, key, xsize, ysize, create);
}
@@ -1428,10 +1428,10 @@ void BKE_node_preview_init_tree(bNodeTree *ntree, int xsize, int ysize, int crea
{
if (!ntree)
return;
-
+
if (!ntree->previews)
ntree->previews = BKE_node_instance_hash_new("node previews");
-
+
node_preview_init_tree_recursive(ntree->previews, ntree, NODE_INSTANCE_KEY_BASE, xsize, ysize, create_previews);
}
@@ -1440,10 +1440,10 @@ static void node_preview_tag_used_recursive(bNodeInstanceHash *previews, bNodeTr
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node);
-
+
if (BKE_node_preview_used(node))
BKE_node_instance_hash_tag_key(previews, key);
-
+
if (node->type == NODE_GROUP && node->id)
node_preview_tag_used_recursive(previews, (bNodeTree *)node->id, key);
}
@@ -1453,11 +1453,11 @@ void BKE_node_preview_remove_unused(bNodeTree *ntree)
{
if (!ntree || !ntree->previews)
return;
-
+
/* use the instance hash functions for tagging and removing unused previews */
BKE_node_instance_hash_clear_tags(ntree->previews);
node_preview_tag_used_recursive(ntree->previews, ntree, NODE_INSTANCE_KEY_BASE);
-
+
BKE_node_instance_hash_remove_untagged(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
}
@@ -1465,7 +1465,7 @@ void BKE_node_preview_free_tree(bNodeTree *ntree)
{
if (!ntree)
return;
-
+
if (ntree->previews) {
BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
ntree->previews = NULL;
@@ -1481,10 +1481,10 @@ void BKE_node_preview_clear(bNodePreview *preview)
void BKE_node_preview_clear_tree(bNodeTree *ntree)
{
bNodeInstanceHashIterator iter;
-
+
if (!ntree || !ntree->previews)
return;
-
+
NODE_INSTANCE_HASH_ITER(iter, ntree->previews) {
bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter);
BKE_node_preview_clear(preview);
@@ -1495,7 +1495,7 @@ static void node_preview_sync(bNodePreview *to, bNodePreview *from)
{
/* sizes should have been initialized by BKE_node_preview_init_tree */
BLI_assert(to->xsize == from->xsize && to->ysize == from->ysize);
-
+
/* copy over contents of previews */
if (to->rect && from->rect) {
int xsize = to->xsize;
@@ -1509,15 +1509,15 @@ void BKE_node_preview_sync_tree(bNodeTree *to_ntree, bNodeTree *from_ntree)
bNodeInstanceHash *from_previews = from_ntree->previews;
bNodeInstanceHash *to_previews = to_ntree->previews;
bNodeInstanceHashIterator iter;
-
+
if (!from_previews || !to_previews)
return;
-
+
NODE_INSTANCE_HASH_ITER(iter, from_previews) {
bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key(&iter);
bNodePreview *from = BKE_node_instance_hash_iterator_get_value(&iter);
bNodePreview *to = BKE_node_instance_hash_lookup(to_previews, key);
-
+
if (from && to)
node_preview_sync(to, from);
}
@@ -1529,27 +1529,27 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo
/* free old previews */
if (to_ntree->previews)
BKE_node_instance_hash_free(to_ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
-
+
/* transfer previews */
to_ntree->previews = from_ntree->previews;
from_ntree->previews = NULL;
-
+
/* clean up, in case any to_ntree nodes have been removed */
BKE_node_preview_remove_unused(to_ntree);
}
else {
bNodeInstanceHashIterator iter;
-
+
if (from_ntree->previews) {
NODE_INSTANCE_HASH_ITER(iter, from_ntree->previews) {
bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key(&iter);
bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter);
-
+
/* replace existing previews */
BKE_node_instance_hash_remove(to_ntree->previews, key, (bNodeInstanceValueFP)BKE_node_preview_free);
BKE_node_instance_hash_insert(to_ntree->previews, key, preview);
}
-
+
/* Note: NULL free function here, because pointers have already been moved over to to_ntree->previews! */
BKE_node_instance_hash_free(from_ntree->previews, NULL);
from_ntree->previews = NULL;
@@ -1557,7 +1557,7 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo
}
}
-/* hack warning! this function is only used for shader previews, and
+/* hack warning! this function is only used for shader previews, and
* since it gets called multiple times per pixel for Ztransp we only
* add the color once. Preview gets cleared before it starts render though */
void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x, int y, bool do_manage)
@@ -1566,7 +1566,7 @@ void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x
if (x >= 0 && y >= 0) {
if (x < preview->xsize && y < preview->ysize) {
unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x);
-
+
if (do_manage) {
linearrgb_to_srgb_uchar4(tar, col);
}
@@ -1591,10 +1591,10 @@ static void nodeClearPreview(bNode *node)
void ntreeClearPreview(bNodeTree *ntree)
{
bNode *node;
-
+
if (ntree == NULL)
return;
-
+
for (node = ntree->nodes.first; node; node = node->next) {
if (node->typeinfo->flag & NODE_PREVIEW)
nodeClearPreview(node);
@@ -1603,7 +1603,7 @@ void ntreeClearPreview(bNodeTree *ntree)
}
}
-/* hack warning! this function is only used for shader previews, and
+/* hack warning! this function is only used for shader previews, and
* since it gets called multiple times per pixel for Ztransp we only
* add the color once. Preview gets cleared before it starts render though */
void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_manage)
@@ -1613,7 +1613,7 @@ void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_mana
if (x >= 0 && y >= 0) {
if (x < preview->xsize && y < preview->ysize) {
unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x);
-
+
if (do_manage) {
linearrgb_to_srgb_uchar4(tar, col);
}
@@ -1636,10 +1636,10 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node)
bNodeLink *link, *next;
bNodeSocket *sock;
ListBase *lb;
-
+
for (link = ntree->links.first; link; link = next) {
next = link->next;
-
+
if (link->fromnode == node) {
lb = &node->outputs;
if (link->tonode)
@@ -1675,30 +1675,30 @@ static void node_unlink_attached(bNodeTree *ntree, bNode *parent)
static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdata, bool use_api_free_cb)
{
bNodeSocket *sock, *nextsock;
-
+
/* don't remove node animdata if the tree is localized,
* Action is shared with the original tree (T38221)
*/
remove_animdata &= ntree && !(ntree->flag & NTREE_IS_LOCALIZED);
-
+
/* extra free callback */
if (use_api_free_cb && node->typeinfo->freefunc_api) {
PointerRNA ptr;
RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
-
+
node->typeinfo->freefunc_api(&ptr);
}
-
+
/* since it is called while free database, node->id is undefined */
-
+
/* can be called for nodes outside a node tree (e.g. clipboard) */
if (ntree) {
/* remove all references to this node */
nodeUnlinkNode(ntree, node);
node_unlink_attached(ntree, node);
-
+
BLI_remlink(&ntree->nodes, node);
-
+
if (remove_animdata) {
char propname_esc[MAX_IDPROP_NAME * 2];
char prefix[MAX_IDPROP_NAME * 2];
@@ -1711,7 +1711,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
if (ntree->typeinfo->free_node_cache)
ntree->typeinfo->free_node_cache(ntree, node);
-
+
/* texture node has bad habit of keeping exec data around */
if (ntree->type == NTREE_TEXTURE && ntree->execdata) {
ntreeTexEndExecTree(ntree->execdata);
@@ -1742,7 +1742,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat
}
MEM_freeN(node);
-
+
if (ntree)
ntree->update |= NTREE_UPDATE_NODES;
}
@@ -1758,7 +1758,7 @@ static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *so
IDP_FreeProperty(sock->prop);
MEM_freeN(sock->prop);
}
-
+
if (sock->default_value)
MEM_freeN(sock->default_value);
}
@@ -1766,7 +1766,7 @@ static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *so
static void free_localized_node_groups(bNodeTree *ntree)
{
bNode *node;
-
+
/* Only localized node trees store a copy for each node group tree.
* Each node group tree in a localized node tree can be freed,
* since it is a localized copy itself (no risk of accessing free'd
@@ -1774,7 +1774,7 @@ static void free_localized_node_groups(bNodeTree *ntree)
*/
if (!(ntree->flag & NTREE_IS_LOCALIZED))
return;
-
+
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == NODE_GROUP && node->id) {
bNodeTree *ngroup = (bNodeTree *)node->id;
@@ -1809,15 +1809,15 @@ void ntreeFreeTree(bNodeTree *ntree)
break;
}
}
-
+
/* XXX not nice, but needed to free localized node groups properly */
free_localized_node_groups(ntree);
-
+
/* unregister associated RNA types */
ntreeInterfaceTypeFree(ntree);
-
+
BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */
-
+
for (node = ntree->nodes.first; node; node = next) {
next = node->next;
node_free_node_ex(ntree, node, false, false);
@@ -1834,7 +1834,7 @@ void ntreeFreeTree(bNodeTree *ntree)
node_socket_interface_free(ntree, sock);
MEM_freeN(sock);
}
-
+
/* free preview hash */
if (ntree->previews) {
BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free);
@@ -1842,7 +1842,7 @@ void ntreeFreeTree(bNodeTree *ntree)
if (ntree->duplilock)
BLI_mutex_free(ntree->duplilock);
-
+
/* if ntree is not part of library, free the libblock data explicitly */
for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next)
if (tntree == ntree)
@@ -1855,7 +1855,7 @@ void ntreeFreeTree(bNodeTree *ntree)
void ntreeFreeCache(bNodeTree *ntree)
{
if (ntree == NULL) return;
-
+
if (ntree->typeinfo->free_cache)
ntree->typeinfo->free_cache(ntree);
}
@@ -1869,7 +1869,7 @@ void ntreeSetOutput(bNodeTree *ntree)
if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) {
bNode *tnode;
int output = 0;
-
+
/* we need a check for which output node should be tagged like this, below an exception */
if (node->type == CMP_NODE_OUTPUT_FILE)
continue;
@@ -1877,9 +1877,9 @@ void ntreeSetOutput(bNodeTree *ntree)
/* there is more types having output class, each one is checked */
for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) {
if (tnode->typeinfo->nclass == NODE_CLASS_OUTPUT) {
-
+
if (ntree->type == NTREE_COMPOSIT) {
-
+
/* same type, exception for viewer */
if (tnode->type == node->type ||
(ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) &&
@@ -1907,12 +1907,12 @@ void ntreeSetOutput(bNodeTree *ntree)
if (output == 0)
node->flag |= NODE_DO_OUTPUT;
}
-
+
/* group node outputs use this flag too */
if (node->type == NODE_GROUP_OUTPUT) {
bNode *tnode;
int output = 0;
-
+
for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) {
if (tnode->type == NODE_GROUP_OUTPUT) {
if (tnode->flag & NODE_DO_OUTPUT) {
@@ -1926,7 +1926,7 @@ void ntreeSetOutput(bNodeTree *ntree)
node->flag |= NODE_DO_OUTPUT;
}
}
-
+
/* here we could recursively set which nodes have to be done,
* might be different for editor or for "real" use... */
}
@@ -2075,7 +2075,7 @@ void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
if (ntree && localtree) {
if (ntree->typeinfo->local_merge)
ntree->typeinfo->local_merge(bmain, localtree, ntree);
-
+
ntreeFreeTree(localtree);
MEM_freeN(localtree);
}
@@ -2100,7 +2100,7 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree, int in_out,
node_socket_set_typeinfo(ntree, sock, stype);
sock->in_out = in_out;
sock->type = SOCK_CUSTOM; /* int type undefined by default */
-
+
/* assign new unique index */
own_index = ntree->cur_index++;
/* use the own_index as socket identifier */
@@ -2127,13 +2127,13 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree, int in_out,
#endif
#endif /* USE_NODE_COMPAT_CUSTOMNODES */
-
+
sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
-
+
BLI_strncpy(sock->name, name, NODE_MAXSTR);
sock->storage = NULL;
sock->flag |= SOCK_COLLAPSED;
-
+
return sock;
}
@@ -2149,7 +2149,7 @@ bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree, int in_out, const char *
bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree, int in_out, const char *idname, const char *name)
{
bNodeSocket *iosock;
-
+
iosock = make_socket_interface(ntree, in_out, idname, name);
if (in_out == SOCK_IN) {
BLI_addtail(&ntree->inputs, iosock);
@@ -2159,7 +2159,7 @@ bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree, int in_out, const char *i
BLI_addtail(&ntree->outputs, iosock);
ntree->update |= NTREE_UPDATE_GROUP_OUT;
}
-
+
return iosock;
}
@@ -2167,7 +2167,7 @@ bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree, int in_out, const char
bNodeSocket *next_sock, const char *name)
{
bNodeSocket *iosock;
-
+
iosock = make_socket_interface(ntree, in_out, idname, name);
if (in_out == SOCK_IN) {
BLI_insertlinkbefore(&ntree->inputs, next_sock, iosock);
@@ -2177,7 +2177,7 @@ bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree, int in_out, const char
BLI_insertlinkbefore(&ntree->outputs, next_sock, iosock);
ntree->update |= NTREE_UPDATE_GROUP_OUT;
}
-
+
return iosock;
}
@@ -2206,10 +2206,10 @@ void ntreeRemoveSocketInterface(bNodeTree *ntree, bNodeSocket *sock)
/* this is fast, this way we don't need an in_out argument */
BLI_remlink(&ntree->inputs, sock);
BLI_remlink(&ntree->outputs, sock);
-
+
node_socket_interface_free(ntree, sock);
MEM_freeN(sock);
-
+
ntree->update |= NTREE_UPDATE_GROUP;
}
@@ -2236,7 +2236,7 @@ static void ntree_interface_identifier(bNodeTree *ntree, const char *base, char
*/
identifier[0] = '\0';
BLI_uniquename_cb(ntree_interface_unique_identifier_check, NULL, base, '_', identifier, maxlen);
-
+
sprintf(name, "Node Tree %s Interface", ntree->id.name + 2);
sprintf(description, "Interface properties of node group %s", ntree->id.name + 2);
}
@@ -2247,20 +2247,20 @@ static void ntree_interface_type_create(bNodeTree *ntree)
bNodeSocket *sock;
/* strings are generated from base string + ID name, sizes are sufficient */
char base[MAX_ID_NAME + 64], identifier[MAX_ID_NAME + 64], name[MAX_ID_NAME + 64], description[MAX_ID_NAME + 64];
-
+
/* generate a valid RNA identifier */
ntree_interface_identifier_base(ntree, base);
ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description);
-
+
/* register a subtype of PropertyGroup */
srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup);
RNA_def_struct_ui_text(srna, name, description);
RNA_def_struct_duplicate_pointers(&BLENDER_RNA, srna);
-
+
/* associate the RNA type with the node tree */
ntree->interface_type = srna;
RNA_struct_blender_type_set(srna, ntree);
-
+
/* add socket properties */
for (sock = ntree->inputs.first; sock; sock = sock->next) {
bNodeSocketType *stype = sock->typeinfo;
@@ -2279,20 +2279,20 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create)
if (ntree->interface_type) {
/* strings are generated from base string + ID name, sizes are sufficient */
char base[MAX_ID_NAME + 64], identifier[MAX_ID_NAME + 64], name[MAX_ID_NAME + 64], description[MAX_ID_NAME + 64];
-
+
/* A bit of a hack: when changing the ID name, update the RNA type identifier too,
* so that the names match. This is not strictly necessary to keep it working,
* but better for identifying associated NodeTree blocks and RNA types.
*/
StructRNA *srna = ntree->interface_type;
-
+
ntree_interface_identifier_base(ntree, base);
-
+
/* RNA identifier may have a number suffix, but should start with the idbase string */
if (!STREQLEN(RNA_struct_identifier(srna), base, sizeof(base))) {
/* generate new unique RNA identifier from the ID name */
ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description);
-
+
/* rename the RNA type */
RNA_def_struct_free_pointers(&BLENDER_RNA, srna);
RNA_def_struct_identifier(&BLENDER_RNA, srna, identifier);
@@ -2303,7 +2303,7 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create)
else if (create) {
ntree_interface_type_create(ntree);
}
-
+
return ntree->interface_type;
}
@@ -2364,7 +2364,7 @@ bool ntreeHasTree(const bNodeTree *ntree, const bNodeTree *lookup)
bNodeLink *nodeFindLink(bNodeTree *ntree, bNodeSocket *from, bNodeSocket *to)
{
bNodeLink *link;
-
+
for (link = ntree->links.first; link; link = link->next) {
if (link->fromsock == from && link->tosock == to)
return link;
@@ -2378,7 +2378,7 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
{
bNodeLink *link;
int tot = 0;
-
+
for (link = ntree->links.first; link; link = link->next) {
if (link->fromsock == sock || link->tosock == sock)
tot++;
@@ -2389,9 +2389,9 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
bNode *nodeGetActive(bNodeTree *ntree)
{
bNode *node;
-
+
if (ntree == NULL) return NULL;
-
+
for (node = ntree->nodes.first; node; node = node->next)
if (node->flag & NODE_ACTIVE)
break;
@@ -2422,7 +2422,7 @@ static bNode *node_get_active_id_recursive(bNodeInstanceKey active_key, bNodeIns
}
}
}
-
+
return NULL;
}
@@ -2471,9 +2471,9 @@ bool nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
void nodeClearActiveID(bNodeTree *ntree, short idtype)
{
bNode *node;
-
+
if (ntree == NULL) return;
-
+
for (node = ntree->nodes.first; node; node = node->next)
if (node->id && GS(node->id->name) == idtype)
node->flag &= ~NODE_ACTIVE_ID;
@@ -2486,9 +2486,9 @@ void nodeSetSelected(bNode *node, bool select)
}
else {
bNodeSocket *sock;
-
+
node->flag &= ~NODE_SELECT;
-
+
/* deselect sockets too */
for (sock = node->inputs.first; sock; sock = sock->next)
sock->flag &= ~NODE_SELECT;
@@ -2511,11 +2511,11 @@ void nodeClearActive(bNodeTree *ntree)
void nodeSetActive(bNodeTree *ntree, bNode *node)
{
bNode *tnode;
-
+
/* make sure only one node is active, and only one per ID type */
for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) {
tnode->flag &= ~NODE_ACTIVE;
-
+
if (node->id && tnode->id) {
if (GS(node->id->name) == GS(tnode->id->name))
tnode->flag &= ~NODE_ACTIVE_ID;
@@ -2523,7 +2523,7 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE)
tnode->flag &= ~NODE_ACTIVE_TEXTURE;
}
-
+
node->flag |= NODE_ACTIVE;
if (node->id)
node->flag |= NODE_ACTIVE_ID;
@@ -2579,13 +2579,13 @@ void BKE_node_clipboard_clear(void)
{
bNode *node, *node_next;
bNodeLink *link, *link_next;
-
+
for (link = node_clipboard.links.first; link; link = link_next) {
link_next = link->next;
nodeRemLink(NULL, link);
}
BLI_listbase_clear(&node_clipboard.links);
-
+
for (node = node_clipboard.nodes.first; node; node = node_next) {
node_next = node->next;
node_free_node_ex(NULL, node, false, false);
@@ -2704,25 +2704,25 @@ const bNodeInstanceKey NODE_INSTANCE_KEY_NONE = {0};
static bNodeInstanceKey node_hash_int_str(bNodeInstanceKey hash, const char *str)
{
char c;
-
+
while ((c = *str++))
hash.value = ((hash.value << 5) + hash.value) ^ c; /* (hash * 33) ^ c */
-
+
/* separator '\0' character, to avoid ambiguity from concatenated strings */
hash.value = (hash.value << 5) + hash.value; /* hash * 33 */
-
+
return hash;
}
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key, bNodeTree *ntree, bNode *node)
{
bNodeInstanceKey key;
-
+
key = node_hash_int_str(parent_key, ntree->id.name + 2);
-
+
if (node)
key = node_hash_int_str(key, node->name);
-
+
return key;
}
@@ -2793,10 +2793,10 @@ int BKE_node_instance_hash_size(bNodeInstanceHash *hash)
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash)
{
bNodeInstanceHashIterator iter;
-
+
NODE_INSTANCE_HASH_ITER(iter, hash) {
bNodeInstanceHashEntry *value = BKE_node_instance_hash_iterator_get_value(&iter);
-
+
value->tag = 0;
}
}
@@ -2810,7 +2810,7 @@ void BKE_node_instance_hash_tag(bNodeInstanceHash *UNUSED(hash), void *value)
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key)
{
bNodeInstanceHashEntry *entry = BKE_node_instance_hash_lookup(hash, key);
-
+
if (entry) {
entry->tag = 1;
return true;
@@ -2827,19 +2827,19 @@ void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash, bNodeInstan
bNodeInstanceKey *untagged = MEM_mallocN(sizeof(bNodeInstanceKey) * BKE_node_instance_hash_size(hash), "temporary node instance key list");
bNodeInstanceHashIterator iter;
int num_untagged, i;
-
+
num_untagged = 0;
NODE_INSTANCE_HASH_ITER(iter, hash) {
bNodeInstanceHashEntry *value = BKE_node_instance_hash_iterator_get_value(&iter);
-
+
if (!value->tag)
untagged[num_untagged++] = BKE_node_instance_hash_iterator_get_key(&iter);
}
-
+
for (i = 0; i < num_untagged; ++i) {
BKE_node_instance_hash_remove(hash, untagged[i], valfreefp);
}
-
+
MEM_freeN(untagged);
}
@@ -2852,9 +2852,9 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort
bNode *fromnode;
bNodeLink *link;
int level = 0xFFF;
-
+
node->done = true;
-
+
/* check linked nodes */
for (link = ntree->links.first; link; link = link->next) {
if (link->tonode == node) {
@@ -2865,7 +2865,7 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort
level = fromnode->level - 1;
}
}
-
+
/* check parent node */
if (node->parent) {
if (node->parent->done == 0)
@@ -2873,21 +2873,21 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort
if (node->parent->level <= level)
level = node->parent->level - 1;
}
-
+
if (nsort) {
**nsort = node;
(*nsort)++;
}
-
+
return level;
}
void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes)
{
bNode *node, **nsort;
-
+
*totnodes = 0;
-
+
/* first clear data */
for (node = ntree->nodes.first; node; node = node->next) {
node->done = false;
@@ -2897,9 +2897,9 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
*deplist = NULL;
return;
}
-
+
nsort = *deplist = MEM_callocN((*totnodes) * sizeof(bNode *), "sorted node array");
-
+
/* recursive check */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->done == 0) {
@@ -2912,12 +2912,12 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
static void ntree_update_node_level(bNodeTree *ntree)
{
bNode *node;
-
+
/* first clear tag */
for (node = ntree->nodes.first; node; node = node->next) {
node->done = false;
}
-
+
/* recursive check */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->done == 0) {
@@ -2931,7 +2931,7 @@ void ntreeTagUsedSockets(bNodeTree *ntree)
bNode *node;
bNodeSocket *sock;
bNodeLink *link;
-
+
/* first clear data */
for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -2941,12 +2941,12 @@ void ntreeTagUsedSockets(bNodeTree *ntree)
sock->flag &= ~SOCK_IN_USE;
}
}
-
+
for (link = ntree->links.first; link; link = link->next) {
/* link is unused if either side is disabled */
if ((link->fromsock->flag & SOCK_UNAVAIL) || (link->tosock->flag & SOCK_UNAVAIL))
continue;
-
+
link->fromsock->flag |= SOCK_IN_USE;
link->tosock->flag |= SOCK_IN_USE;
}
@@ -2957,7 +2957,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
bNode *node;
bNodeSocket *sock;
bNodeLink *link;
-
+
/* first clear data */
for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -2968,14 +2968,14 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
for (link = ntree->links.first; link; link = link->next) {
link->tosock->link = link;
}
-
+
ntreeTagUsedSockets(ntree);
}
static void ntree_validate_links(bNodeTree *ntree)
{
bNodeLink *link;
-
+
for (link = ntree->links.first; link; link = link->next) {
link->flag |= NODE_LINK_VALID;
if (link->fromnode && link->tonode && link->fromnode->level <= link->tonode->level)
@@ -2991,7 +2991,7 @@ void ntreeVerifyNodes(struct Main *main, struct ID *id)
{
FOREACH_NODETREE(main, ntree, owner_id) {
bNode *node;
-
+
for (node = ntree->nodes.first; node; node = node->next)
if (node->typeinfo->verifyfunc)
node->typeinfo->verifyfunc(ntree, node, id);
@@ -3001,31 +3001,31 @@ void ntreeVerifyNodes(struct Main *main, struct ID *id)
void ntreeUpdateTree(Main *bmain, bNodeTree *ntree)
{
bNode *node;
-
+
if (!ntree)
return;
-
+
/* avoid reentrant updates, can be caused by RNA update callbacks */
if (ntree->is_updating)
return;
ntree->is_updating = true;
-
+
if (ntree->update & (NTREE_UPDATE_LINKS | NTREE_UPDATE_NODES)) {
/* set the bNodeSocket->link pointers */
ntree_update_link_pointers(ntree);
}
-
+
/* update individual nodes */
for (node = ntree->nodes.first; node; node = node->next) {
/* node tree update tags override individual node update flags */
if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) {
if (node->typeinfo->updatefunc)
node->typeinfo->updatefunc(ntree, node);
-
+
nodeUpdateInternalLinks(ntree, node);
}
}
-
+
/* generic tree update callback */
if (ntree->typeinfo->update)
ntree->typeinfo->update(ntree);
@@ -3034,28 +3034,28 @@ void ntreeUpdateTree(Main *bmain, bNodeTree *ntree)
*/
if (ntree->update & NTREE_UPDATE_GROUP)
ntreeInterfaceTypeUpdate(ntree);
-
+
/* XXX hack, should be done by depsgraph!! */
if (bmain)
ntreeVerifyNodes(bmain, &ntree->id);
-
+
if (ntree->update & (NTREE_UPDATE_LINKS | NTREE_UPDATE_NODES)) {
/* node updates can change sockets or links, repeat link pointer update afterward */
ntree_update_link_pointers(ntree);
-
+
/* update the node level from link dependencies */
ntree_update_node_level(ntree);
-
+
/* check link validity */
ntree_validate_links(ntree);
}
-
+
/* clear update flags */
for (node = ntree->nodes.first; node; node = node->next) {
node->update = 0;
}
ntree->update = 0;
-
+
ntree->is_updating = false;
}
@@ -3065,15 +3065,15 @@ void nodeUpdate(bNodeTree *ntree, bNode *node)
if (ntree->is_updating)
return;
ntree->is_updating = true;
-
+
if (node->typeinfo->updatefunc)
node->typeinfo->updatefunc(ntree, node);
-
+
nodeUpdateInternalLinks(ntree, node);
-
+
/* clear update flag */
node->update = 0;
-
+
ntree->is_updating = false;
}
@@ -3081,15 +3081,15 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id)
{
bNode *node;
bool changed = false;
-
+
if (ELEM(NULL, id, ntree))
return changed;
-
+
/* avoid reentrant updates, can be caused by RNA update callbacks */
if (ntree->is_updating)
return changed;
ntree->is_updating = true;
-
+
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id == id) {
changed = true;
@@ -3100,11 +3100,11 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id)
node->update = 0;
}
}
-
+
for (node = ntree->nodes.first; node; node = node->next) {
nodeUpdateInternalLinks(ntree, node);
}
-
+
ntree->is_updating = false;
return changed;
}
@@ -3112,7 +3112,7 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id)
void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node)
{
BLI_freelistN(&node->internal_links);
-
+
if (node->typeinfo && node->typeinfo->update_internal_links)
node->typeinfo->update_internal_links(ntree, node);
}
@@ -3122,7 +3122,7 @@ void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node)
void nodeSynchronizeID(bNode *node, bool copy_to_id)
{
if (node->id == NULL) return;
-
+
if (ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
bNodeSocket *sock;
Material *ma = (Material *)node->id;
@@ -3131,7 +3131,7 @@ void nodeSynchronizeID(bNode *node, bool copy_to_id)
if (!copy_to_id)
check_flags |= SOCK_HIDDEN;
-
+
/* hrmf, case in loop isn't super fast, but we don't edit 100s of material at same time either! */
for (a = 0, sock = node->inputs.first; sock; sock = sock->next, a++) {
if (!(sock->flag & check_flags)) {
@@ -3250,14 +3250,14 @@ void node_type_base(bNodeType *ntype, int type, const char *name, short nclass,
BLI_assert(ntype->ext.srna != NULL); \
RNA_struct_blender_type_set(ntype->ext.srna, ntype); \
break;
-
+
switch (type) {
#include "NOD_static_types.h"
}
-
+
/* make sure we have a valid type (everything registered) */
BLI_assert(ntype->idname[0] != '\0');
-
+
ntype->type = type;
BLI_strncpy(ntype->ui_name, name, sizeof(ntype->ui_name));
ntype->nclass = nclass;
@@ -3284,7 +3284,7 @@ static bool unique_socket_template_identifier_check(void *arg, const char *name)
{
bNodeSocketTemplate *ntemp;
struct {bNodeSocketTemplate *list; bNodeSocketTemplate *ntemp;} *data = arg;
-
+
for (ntemp = data->list; ntemp->type >= 0; ++ntemp) {
if (ntemp != data->ntemp) {
if (STREQ(ntemp->identifier, name)) {
@@ -3292,7 +3292,7 @@ static bool unique_socket_template_identifier_check(void *arg, const char *name)
}
}
}
-
+
return false;
}
@@ -3308,16 +3308,16 @@ static void unique_socket_template_identifier(bNodeSocketTemplate *list, bNodeSo
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
{
bNodeSocketTemplate *ntemp;
-
+
ntype->inputs = inputs;
ntype->outputs = outputs;
-
+
/* automatically generate unique identifiers */
if (inputs) {
/* clear identifier strings (uninitialized memory) */
for (ntemp = inputs; ntemp->type >= 0; ++ntemp)
ntemp->identifier[0] = '\0';
-
+
for (ntemp = inputs; ntemp->type >= 0; ++ntemp) {
BLI_strncpy(ntemp->identifier, ntemp->name, sizeof(ntemp->identifier));
unique_socket_template_identifier(inputs, ntemp, ntemp->identifier, '_');
@@ -3327,7 +3327,7 @@ void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTempl
/* clear identifier strings (uninitialized memory) */
for (ntemp = outputs; ntemp->type >= 0; ++ntemp)
ntemp->identifier[0] = '\0';
-
+
for (ntemp = outputs; ntemp->type >= 0; ++ntemp) {
BLI_strncpy(ntemp->identifier, ntemp->name, sizeof(ntemp->identifier));
unique_socket_template_identifier(outputs, ntemp, ntemp->identifier, '_');
@@ -3434,14 +3434,14 @@ static void register_undefined_types(void)
/* Note: these types are not registered in the type hashes,
* they are just used as placeholders in case the actual types are not registered.
*/
-
+
strcpy(NodeTreeTypeUndefined.idname, "NodeTreeUndefined");
strcpy(NodeTreeTypeUndefined.ui_name, "Undefined");
strcpy(NodeTreeTypeUndefined.ui_description, "Undefined Node Tree Type");
-
+
node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0, 0);
NodeTypeUndefined.poll = node_undefined_poll;
-
+
BLI_strncpy(NodeSocketTypeUndefined.idname, "NodeSocketUndefined", sizeof(NodeSocketTypeUndefined.idname));
/* extra type info for standard socket types */
NodeSocketTypeUndefined.type = SOCK_CUSTOM;
@@ -3451,7 +3451,7 @@ static void register_undefined_types(void)
static void registerCompositNodes(void)
{
register_node_type_cmp_group();
-
+
register_node_type_cmp_rlayers();
register_node_type_cmp_image();
register_node_type_cmp_texture();
@@ -3459,13 +3459,13 @@ static void registerCompositNodes(void)
register_node_type_cmp_rgb();
register_node_type_cmp_curve_time();
register_node_type_cmp_movieclip();
-
+
register_node_type_cmp_composite();
register_node_type_cmp_viewer();
register_node_type_cmp_splitviewer();
register_node_type_cmp_output_file();
register_node_type_cmp_view_levels();
-
+
register_node_type_cmp_curve_rgb();
register_node_type_cmp_mix_rgb();
register_node_type_cmp_hue_sat();
@@ -3476,13 +3476,13 @@ static void registerCompositNodes(void)
register_node_type_cmp_zcombine();
register_node_type_cmp_colorbalance();
register_node_type_cmp_huecorrect();
-
+
register_node_type_cmp_normal();
register_node_type_cmp_curve_vec();
register_node_type_cmp_map_value();
register_node_type_cmp_map_range();
register_node_type_cmp_normalize();
-
+
register_node_type_cmp_filter();
register_node_type_cmp_blur();
register_node_type_cmp_dblur();
@@ -3493,7 +3493,7 @@ static void registerCompositNodes(void)
register_node_type_cmp_despeckle();
register_node_type_cmp_defocus();
register_node_type_cmp_sunbeams();
-
+
register_node_type_cmp_valtorgb();
register_node_type_cmp_rgbtobw();
register_node_type_cmp_setalpha();
@@ -3508,7 +3508,7 @@ static void registerCompositNodes(void)
register_node_type_cmp_sepycca();
register_node_type_cmp_combycca();
register_node_type_cmp_premulkey();
-
+
register_node_type_cmp_diff_matte();
register_node_type_cmp_distance_matte();
register_node_type_cmp_chroma_matte();
@@ -3549,7 +3549,7 @@ static void registerCompositNodes(void)
register_node_type_cmp_cornerpin();
}
-static void registerShaderNodes(void)
+static void registerShaderNodes(void)
{
register_node_type_sh_group();
@@ -3647,7 +3647,7 @@ static void registerTextureNodes(void)
{
register_node_type_tex_group();
-
+
register_node_type_tex_math();
register_node_type_tex_mix_rgb();
register_node_type_tex_valtorgb();
@@ -3661,26 +3661,26 @@ static void registerTextureNodes(void)
register_node_type_tex_distance();
register_node_type_tex_compose();
register_node_type_tex_decompose();
-
+
register_node_type_tex_output();
register_node_type_tex_viewer();
register_node_type_sh_script();
register_node_type_sh_tangent();
register_node_type_sh_normal_map();
register_node_type_sh_hair_info();
-
+
register_node_type_tex_checker();
register_node_type_tex_texture();
register_node_type_tex_bricks();
register_node_type_tex_image();
register_node_type_sh_bsdf_refraction();
register_node_type_sh_ambient_occlusion();
-
+
register_node_type_tex_rotate();
register_node_type_tex_translate();
register_node_type_tex_scale();
register_node_type_tex_at();
-
+
register_node_type_tex_proc_voronoi();
register_node_type_tex_proc_blend();
register_node_type_tex_proc_magic();
@@ -3693,7 +3693,7 @@ static void registerTextureNodes(void)
register_node_type_tex_proc_distnoise();
}
-void init_nodesystem(void)
+void init_nodesystem(void)
{
nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh");
nodetypes_hash = BLI_ghash_str_new("nodetypes_hash gh");
@@ -3712,13 +3712,13 @@ void init_nodesystem(void)
register_node_type_reroute();
register_node_type_group_input();
register_node_type_group_output();
-
+
registerCompositNodes();
registerShaderNodes();
registerTextureNodes();
}
-void free_nodesystem(void)
+void free_nodesystem(void)
{
if (nodetypes_hash) {
NODE_TYPES_BEGIN(nt)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 01e1192eb0c..eeb0ab22bd6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -146,7 +146,7 @@ static ThreadMutex vparent_lock = BLI_MUTEX_INITIALIZER;
void BKE_object_workob_clear(Object *workob)
{
memset(workob, 0, sizeof(Object));
-
+
workob->size[0] = workob->size[1] = workob->size[2] = 1.0f;
workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f;
workob->rotmode = ROT_MODE_EUL;
@@ -356,7 +356,7 @@ void BKE_object_free_derived_caches(Object *ob)
ob->derivedDeform->release(ob->derivedDeform);
ob->derivedDeform = NULL;
}
-
+
BKE_object_free_curve_cache(ob);
}
@@ -432,9 +432,9 @@ void BKE_object_free(Object *ob)
free_sensors(&ob->sensors);
free_controllers(&ob->controllers);
free_actuators(&ob->actuators);
-
+
BKE_constraints_free_ex(&ob->constraints, false);
-
+
free_partdeflect(ob->pd);
BKE_rigidbody_free_object(ob);
BKE_rigidbody_free_constraint(ob);
@@ -472,7 +472,7 @@ bool BKE_object_is_in_editmode(const Object *ob)
{
if (ob->data == NULL)
return false;
-
+
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
if (me->edit_btmesh)
@@ -480,25 +480,25 @@ bool BKE_object_is_in_editmode(const Object *ob)
}
else if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
-
+
if (arm->edbo)
return true;
}
else if (ob->type == OB_FONT) {
Curve *cu = ob->data;
-
+
if (cu->editfont)
return true;
}
else if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
-
+
if (mb->editelems)
return true;
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;
-
+
if (lt->editlatt)
return true;
}
@@ -532,9 +532,9 @@ bool BKE_object_is_in_wpaint_select_vert(const Object *ob)
bool BKE_object_exists_check(Main *bmain, const Object *obtest)
{
Object *ob;
-
+
if (obtest == NULL) return false;
-
+
ob = bmain->object.first;
while (ob) {
if (ob == obtest) return true;
@@ -595,12 +595,12 @@ void BKE_object_init(Object *ob)
ob->col[0] = ob->col[1] = ob->col[2] = 1.0;
ob->col[3] = 1.0;
-
+
ob->size[0] = ob->size[1] = ob->size[2] = 1.0;
ob->dscale[0] = ob->dscale[1] = ob->dscale[2] = 1.0;
-
- /* objects should default to having Euler XYZ rotations,
- * but rotations default to quaternions
+
+ /* objects should default to having Euler XYZ rotations,
+ * but rotations default to quaternions
*/
ob->rotmode = ROT_MODE_EUL;
@@ -612,7 +612,7 @@ void BKE_object_init(Object *ob)
/* rotation locks should be 4D for 4 component rotations by default... */
ob->protectflag = OB_LOCK_ROT4D;
-
+
unit_m4(ob->constinv);
unit_m4(ob->parentinv);
unit_m4(ob->obmat);
@@ -628,7 +628,7 @@ void BKE_object_init(Object *ob)
ob->trackflag = OB_POSY;
ob->upflag = OB_POSZ;
}
-
+
ob->dupon = 1; ob->dupoff = 0;
ob->dupsta = 1; ob->dupend = 100;
ob->dupfacesca = 1.0;
@@ -658,7 +658,7 @@ void BKE_object_init(Object *ob)
ob->fluidsimSettings = NULL;
BLI_listbase_clear(&ob->pc_ids);
-
+
/* Animation Visualization defaults */
animviz_settings_init(&ob->avs);
}
@@ -695,7 +695,7 @@ Object *BKE_object_add(
ob->data = BKE_object_obdata_add_from_type(bmain, type, name);
ob->lay = scene->lay;
-
+
base = BKE_scene_base_add(scene, ob);
BKE_scene_base_deselect_all(scene);
BKE_scene_base_select(scene, base);
@@ -721,7 +721,7 @@ void BKE_object_lod_add(Object *ob)
base->obhysteresis = 10;
last = ob->currentlod = base;
}
-
+
lod->distance = last->distance + 25.0f;
lod->obhysteresis = 10;
lod->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT;
@@ -841,9 +841,9 @@ struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene)
SoftBody *copy_softbody(const SoftBody *sb, const int flag)
{
SoftBody *sbn;
-
+
if (sb == NULL) return(NULL);
-
+
sbn = MEM_dupallocN(sb);
if ((flag & LIB_ID_COPY_CACHES) == 0) {
@@ -869,10 +869,10 @@ SoftBody *copy_softbody(const SoftBody *sb, const int flag)
if (sb->bspring)
sbn->bspring = MEM_dupallocN(sb->bspring);
}
-
+
sbn->keys = NULL;
sbn->totkey = sbn->totpointkey = 0;
-
+
sbn->scratch = NULL;
sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, flag);
@@ -915,10 +915,10 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f
if (key)
key = MEM_dupallocN(key);
-
+
if (boid)
boid = MEM_dupallocN(boid);
-
+
for (p = 0, pa = psysn->particles; p < psysn->totpart; p++, pa++) {
if (boid)
pa->boid = boid++;
@@ -944,11 +944,11 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f
psysn->effectors = NULL;
psysn->tree = NULL;
psysn->bvhtree = NULL;
-
+
BLI_listbase_clear(&psysn->pathcachebufs);
BLI_listbase_clear(&psysn->childcachebufs);
psysn->renderdata = NULL;
-
+
/* XXX Never copy caches here? */
psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, flag & ~LIB_ID_COPY_CACHES);
@@ -998,7 +998,7 @@ void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src, const
}
else if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *) md;
-
+
if (smd->type == MOD_SMOKE_TYPE_FLOW) {
if (smd->flow) {
if (smd->flow->psys == psys)
@@ -1021,31 +1021,31 @@ void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src)
static void copy_object_pose(Object *obn, const Object *ob, const int flag)
{
bPoseChannel *chan;
-
+
/* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */
obn->pose = NULL;
BKE_pose_copy_data_ex(&obn->pose, ob->pose, flag, true); /* true = copy constraints */
for (chan = obn->pose->chanbase.first; chan; chan = chan->next) {
bConstraint *con;
-
+
chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE);
-
+
/* XXX Remapping object pointing onto itself should be handled by generic BKE_library_remap stuff, but...
* the flush_constraint_targets callback am not sure about, so will delay that for now. */
for (con = chan->constraints.first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
-
+
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
-
+
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar == ob)
ct->tar = obn;
}
-
+
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 0);
}
@@ -1123,12 +1123,12 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_
}
if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser);
-
+
if (ob_src->bb) ob_dst->bb = MEM_dupallocN(ob_src->bb);
ob_dst->flag &= ~OB_FROMGROUP;
-
+
BLI_listbase_clear(&ob_dst->modifiers);
-
+
for (md = ob_src->modifiers.first; md; md = md->next) {
ModifierData *nmd = modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
@@ -1165,7 +1165,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_
ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata);
BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata);
-
+
ob_dst->derivedDeform = NULL;
ob_dst->derivedFinal = NULL;
@@ -1175,7 +1175,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_
ob_dst->mpath = NULL;
copy_object_lod(ob_dst, ob_src, flag_subdata);
-
+
/* Do not copy runtime curve data. */
ob_dst->curve_cache = NULL;
@@ -1267,34 +1267,34 @@ static void armature_set_id_extern(Object *ob)
bArmature *arm = ob->data;
bPoseChannel *pchan;
unsigned int lay = arm->layer_protected;
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (!(pchan->bone->layer & lay))
id_lib_extern((ID *)pchan->custom);
}
-
+
}
void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
{
if ((target->adt) && (target->adt->drivers.first)) {
FCurve *fcu;
-
+
/* add new animdata block */
if (!ob->adt)
ob->adt = BKE_animdata_add_id(&ob->id);
-
+
/* make a copy of all the drivers (for now), then correct any links that need fixing */
free_fcurves(&ob->adt->drivers);
copy_fcurves(&ob->adt->drivers, &target->adt->drivers);
-
+
for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
-
+
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
/* all drivers */
- DRIVER_TARGETS_LOOPER(dvar)
+ DRIVER_TARGETS_LOOPER(dvar)
{
if (dtar->id) {
if ((Object *)dtar->id == target)
@@ -1325,14 +1325,14 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
printf("cannot make proxy\n");
return;
}
-
+
ob->proxy = target;
ob->proxy_group = gob;
id_lib_extern(&target->id);
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
DAG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
+
/* copy transform
* - gob means this proxy comes from a group, just apply the matrix
* so the object wont move from its dupli-transform.
@@ -1354,13 +1354,13 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
ob->parent = target->parent; /* libdata */
copy_m4_m4(ob->parentinv, target->parentinv);
}
-
+
/* copy animdata stuff - drivers only for now... */
BKE_object_copy_proxy_drivers(ob, target);
/* skip constraints? */
/* FIXME: this is considered by many as a bug */
-
+
/* set object type and link to data */
ob->type = target->type;
ob->data = target->data;
@@ -1377,24 +1377,24 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
ob->matbits = NULL;
if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
int i;
-
+
ob->actcol = target->actcol;
ob->totcol = target->totcol;
-
+
ob->mat = MEM_dupallocN(target->mat);
ob->matbits = MEM_dupallocN(target->matbits);
for (i = 0; i < target->totcol; i++) {
/* don't need to run test_object_materials since we know this object is new and not used elsewhere */
- id_us_plus((ID *)ob->mat[i]);
+ id_us_plus((ID *)ob->mat[i]);
}
}
-
+
/* type conversions */
if (target->type == OB_ARMATURE) {
copy_object_pose(ob, target, 0); /* data copy, object pointers in constraints */
BKE_pose_rest(ob->pose); /* clear all transforms in channels */
BKE_pose_rebuild(ob, ob->data); /* set all internal links */
-
+
armature_set_id_extern(ob);
}
else if (target->type == OB_EMPTY) {
@@ -1478,7 +1478,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[3][3])
void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot)
{
float rmat[3][3], dmat[3][3];
-
+
/* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied
* with the rotation matrix to yield the appropriate rotation
*/
@@ -1497,14 +1497,14 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot)
else {
/* quats are normalized before use to eliminate scaling issues */
float tquat[4];
-
+
normalize_qt_qt(tquat, ob->quat);
quat_to_mat3(rmat, tquat);
-
+
normalize_qt_qt(tquat, ob->dquat);
quat_to_mat3(dmat, tquat);
}
-
+
/* combine these rotations */
if (use_drot)
mul_m3_m3m3(mat, dmat, rmat);
@@ -1628,7 +1628,7 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */
float smat[3][3];
float rmat[3][3];
/*float q1[4];*/
-
+
/* size */
BKE_object_scale_to_mat3(ob, smat);
@@ -1640,9 +1640,9 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */
void BKE_object_to_mat4(Object *ob, float mat[4][4])
{
float tmat[3][3];
-
+
BKE_object_to_mat3(ob, tmat);
-
+
copy_m4_m3(mat, tmat);
add_v3_v3v3(mat[3], ob->loc, ob->dloc);
@@ -1689,7 +1689,7 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
/* catch exceptions: curve paths used as a duplicator */
if (enable_cu_speed) {
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
+ * but this will only work if it actually is animated...
*
* we divide the curvetime calculated in the previous step by the length of the path, to get a time
* factor, which then gets clamped to lie within 0.0 - 1.0 range
@@ -1713,10 +1713,10 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
if (cu->pathlen) {
ctime /= cu->pathlen;
}
-
+
CLAMP(ctime, 0.0f, 1.0f);
}
-
+
unit_m4(mat);
/* vec: 4 items! */
@@ -1726,7 +1726,7 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
#if 0
float si, q[4];
vec_to_quat(quat, dir, ob->trackflag, ob->upflag);
-
+
/* the tilt */
normalize_v3(dir);
q[0] = cosf(0.5 * vec[3]);
@@ -1741,7 +1741,7 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
normalize_qt(quat);
quat_to_mat4(mat, quat);
}
-
+
if (cu->flag & CU_PATH_RADIUS) {
float tmat[4][4], rmat[4][4];
scale_m4_fl(tmat, radius);
@@ -1750,22 +1750,22 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
}
copy_v3_v3(mat[3], vec);
-
+
}
return true;
}
static void ob_parbone(Object *ob, Object *par, float mat[4][4])
-{
+{
bPoseChannel *pchan;
float vec[3];
-
+
if (par->type != OB_ARMATURE) {
unit_m4(mat);
return;
}
-
+
/* Make sure the bone is still valid */
pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr);
if (!pchan || !pchan->bone) {
@@ -1793,14 +1793,14 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
static void give_parvert(Object *par, int nr, float vec[3])
{
zero_v3(vec);
-
+
if (par->type == OB_MESH) {
Mesh *me = par->data;
BMEditMesh *em = me->edit_btmesh;
DerivedMesh *dm;
dm = (em) ? em->derivedFinal : par->derivedFinal;
-
+
if (dm) {
int count = 0;
int numVerts = dm->getNumVerts(dm);
@@ -1976,16 +1976,16 @@ void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float p
ok = 1;
}
}
-
+
if (ok) mul_m4_m4m4(parentmat, par->obmat, tmat);
else copy_m4_m4(parentmat, par->obmat);
-
+
break;
case PARBONE:
ob_parbone(ob, par, tmat);
mul_m4_m4m4(parentmat, par->obmat, tmat);
break;
-
+
case PARVERT1:
unit_m4(parentmat);
give_parvert(par, ob->par1, vec);
@@ -1993,10 +1993,10 @@ void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float p
break;
case PARVERT3:
ob_parvert3(ob, par, tmat);
-
+
mul_m4_m4m4(parentmat, par->obmat, tmat);
break;
-
+
case PARSKEL:
copy_m4_m4(parentmat, par->obmat);
break;
@@ -2013,22 +2013,22 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4
float totmat[4][4];
float tmat[4][4];
float locmat[4][4];
-
+
BKE_object_to_mat4(ob, locmat);
-
+
if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
BKE_object_get_parent_matrix(scene, ob, par, totmat);
-
+
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
mul_m4_m4m4(obmat, tmat, locmat);
-
+
if (r_originmat) {
/* usable originmat */
copy_m3_m4(r_originmat, tmat);
}
-
+
/* origin, for help line */
if (set_origin) {
if ((ob->partype & PARTYPE) == PARSKEL) {
@@ -2065,18 +2065,18 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
RigidBodyWorld *rbw, float r_originmat[3][3])
{
if (ob == NULL) return;
-
+
/* execute drivers only, as animation has already been done */
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
-
+
if (ob->parent) {
Object *par = ob->parent;
float slowmat[4][4];
-
+
/* calculate parent matrix */
solve_parenting(scene, ob, par, ob->obmat, slowmat, r_originmat, true);
-
- /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around
+
+ /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around
* An old-fashioned hack which probably doesn't really cut it anymore
*/
if (ob->partype & PARSLOW) {
@@ -2092,7 +2092,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
rbw = rbw ? rbw : scene->rigidbody_world;
/* read values pushed into RBO from sim/cache... */
BKE_rigidbody_sync_transforms(rbw, ob, ctime);
-
+
/* solve constraints */
if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
bConstraintOb *cob;
@@ -2100,7 +2100,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
BKE_constraints_solve(&ob->constraints, cob, ctime);
BKE_constraints_clear_evalob(cob);
}
-
+
/* set negative scale flag in object */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
else ob->transflag &= ~OB_NEG_SCALE;
@@ -2122,9 +2122,9 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
float slowmat[4][4];
Object *par = ob->parent;
-
+
solve_parenting(scene, ob, par, obmat, slowmat, NULL, false);
-
+
if (ob->partype & PARSLOW)
where_is_object_parslow(ob, obmat, slowmat);
}
@@ -2146,7 +2146,7 @@ void BKE_object_where_is_calc(Scene *scene, Object *ob)
void BKE_object_workob_calc_parent(Scene *scene, Object *ob, Object *workob)
{
BKE_object_workob_clear(workob);
-
+
unit_m4(workob->obmat);
unit_m4(workob->parentinv);
unit_m4(workob->constinv);
@@ -2154,7 +2154,7 @@ void BKE_object_workob_calc_parent(Scene *scene, Object *ob, Object *workob)
workob->trackflag = ob->trackflag;
workob->upflag = ob->upflag;
-
+
workob->partype = ob->partype;
workob->par1 = ob->par1;
workob->par2 = ob->par2;
@@ -2207,7 +2207,7 @@ BoundBox *BKE_boundbox_alloc_unit(void)
bb = MEM_callocN(sizeof(BoundBox), "OB-BoundBox");
BKE_boundbox_init_from_minmax(bb, min, max);
-
+
return bb;
}
@@ -2215,7 +2215,7 @@ void BKE_boundbox_init_from_minmax(BoundBox *bb, const float min[3], const float
{
bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = min[0];
bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = max[0];
-
+
bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = min[1];
bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = max[1];
@@ -2250,7 +2250,7 @@ void BKE_boundbox_minmax(const BoundBox *bb, float obmat[4][4], float r_min[3],
BoundBox *BKE_object_boundbox_get(Object *ob)
{
BoundBox *bb = NULL;
-
+
if (ob->type == OB_MESH) {
bb = BKE_mesh_boundbox_get(ob);
}
@@ -2282,13 +2282,13 @@ void BKE_object_boundbox_flag(Object *ob, int flag, const bool set)
void BKE_object_dimensions_get(Object *ob, float vec[3])
{
BoundBox *bb = NULL;
-
+
bb = BKE_object_boundbox_get(ob);
if (bb) {
float scale[3];
-
+
mat4_to_size(scale, ob->obmat);
-
+
vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
@@ -2301,17 +2301,17 @@ void BKE_object_dimensions_get(Object *ob, float vec[3])
void BKE_object_dimensions_set(Object *ob, const float value[3])
{
BoundBox *bb = NULL;
-
+
bb = BKE_object_boundbox_get(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];
@@ -2323,7 +2323,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
BoundBox bb;
float vec[3];
bool changed = false;
-
+
switch (ob->type) {
case OB_CURVE:
case OB_FONT:
@@ -2669,7 +2669,7 @@ void BKE_object_handle_update_ex(Main *bmain,
object_handle_update_proxy(bmain, eval_ctx, scene, ob, do_proxy_update);
}
-/* WARNING: "scene" here may not be the scene object actually resides in.
+/* WARNING: "scene" here may not be the scene object actually resides in.
* When dealing with background-sets, "scene" is actually the active scene.
* e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n
* rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world
@@ -2714,10 +2714,10 @@ void BKE_object_sculpt_modifiers_changed(Object *ob)
int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot)
{
-
+
if (ob->data == NULL)
return 0;
-
+
switch (GS(((ID *)ob->data)->name)) {
case ID_ME:
{
@@ -2766,7 +2766,7 @@ static int pc_cmp(const void *a, const void *b)
else return 0;
}
-int BKE_object_insert_ptcache(Object *ob)
+int BKE_object_insert_ptcache(Object *ob)
{
LinkData *link = NULL;
int i = 0;
@@ -2791,18 +2791,18 @@ static int pc_findindex(ListBase *listbase, int index)
{
LinkData *link = NULL;
int number = 0;
-
+
if (listbase == NULL) return -1;
-
+
link = listbase->first;
while (link) {
if (GET_INT_FROM_POINTER(link->data) == index)
return number;
-
+
number++;
link = link->next;
}
-
+
return -1;
}
@@ -2927,7 +2927,7 @@ static KeyBlock *insert_curvekey(Main *bmain, Object *ob, const char *name, cons
}
KeyBlock *BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, const bool from_mix)
-{
+{
switch (ob->type) {
case OB_MESH:
return insert_meshkey(bmain, ob, name, from_mix);
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 61533e13d7a..aeeabf4360a 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -132,7 +132,7 @@ bDeformGroup *BKE_object_defgroup_add_name(Object *ob, const char *name)
/**
* Add a vgroup of default name to object. *Does not* handle MDeformVert data at all!
*/
-bDeformGroup *BKE_object_defgroup_add(Object *ob)
+bDeformGroup *BKE_object_defgroup_add(Object *ob)
{
return BKE_object_defgroup_add_name(ob, DATA_("Group"));
}
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 4201bf3d3fb..589c4468000 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -126,7 +126,7 @@ static void init_context(
static void copy_dupli_context(DupliContext *r_ctx, const DupliContext *ctx, Object *ob, float mat[4][4], int index, bool animated)
{
*r_ctx = *ctx;
-
+
r_ctx->animated |= animated; /* object animation makes all children animated */
/* XXX annoying, previously was done by passing an ID* argument, this at least is more explicit */
@@ -1281,7 +1281,7 @@ DupliApplyData *duplilist_apply(Object *ob, Scene *scene, ListBase *duplilist)
{
DupliApplyData *apply_data = NULL;
int num_objects = BLI_listbase_count(duplilist);
-
+
if (num_objects > 0) {
DupliObject *dob;
int i;
@@ -1302,7 +1302,7 @@ DupliApplyData *duplilist_apply(Object *ob, Scene *scene, ListBase *duplilist)
/* copy obmat from duplis */
copy_m4_m4(apply_data->extra[i].obmat, dob->ob->obmat);
copy_m4_m4(dob->ob->obmat, dob->mat);
-
+
/* copy layers from the main duplicator object */
apply_data->extra[i].lay = dob->ob->lay;
dob->ob->lay = ob->lay;
@@ -1322,7 +1322,7 @@ void duplilist_restore(ListBase *duplilist, DupliApplyData *apply_data)
for (dob = duplilist->last, i = apply_data->num_objects - 1; dob; dob = dob->prev, --i) {
copy_m4_m4(dob->ob->obmat, apply_data->extra[i].obmat);
dob->ob->transflag &= ~OB_DUPLICALCDERIVED;
-
+
dob->ob->lay = apply_data->extra[i].lay;
}
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 2d8527f23d6..7f3f916964a 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -156,7 +156,7 @@ static float gaussRand(RNG *rng)
{
/* Note: to avoid numerical problems with very small numbers, we make these variables singe-precision floats,
* but later we call the double-precision log() and sqrt() functions instead of logf() and sqrtf().
- */
+ */
float x;
float y;
float length2;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 07cd28da556..da455faaa86 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -34,7 +34,7 @@
#include <fcntl.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
@@ -90,14 +90,14 @@ int seekPackedFile(PackedFile *pf, int offset, int whence)
return(oldseek);
}
-
+
void rewindPackedFile(PackedFile *pf)
{
seekPackedFile(pf, 0, SEEK_SET);
}
int readPackedFile(PackedFile *pf, void *data, int size)
-{
+{
if ((pf != NULL) && (size >= 0) && (data != NULL)) {
if (size + pf->seek > pf->size) {
size = pf->size - pf->seek;
@@ -125,7 +125,7 @@ int countPackedFiles(Main *bmain)
VFont *vf;
bSound *sound;
int count = 0;
-
+
/* let's check if there are packed files... */
for (ima = bmain->image.first; ima; ima = ima->id.next)
if (BKE_image_has_packedfile(ima))
@@ -167,7 +167,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen)
PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile");
pf->data = mem;
pf->size = memlen;
-
+
return pf;
}
@@ -177,14 +177,14 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
int file, filelen;
char name[FILE_MAX];
void *data;
-
+
/* render result has no filename and can be ignored
* any other files with no name can be ignored too */
if (filename[0] == '\0')
return NULL;
//XXX waitcursor(1);
-
+
/* convert relative filenames to absolute filenames */
BLI_strncpy(name, filename, sizeof(name));
@@ -219,7 +219,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
}
//XXX waitcursor(0);
-
+
return (pf);
}
@@ -230,7 +230,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
VFont *vfont;
bSound *sound;
int tot = 0;
-
+
for (ima = bmain->image.first; ima; ima = ima->id.next) {
if (BKE_image_has_packedfile(ima) == false && !ID_IS_LINKED(ima)) {
if (ima->source == IMA_SRC_FILE) {
@@ -257,7 +257,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
tot++;
}
}
-
+
if (tot > 0)
BKE_reportf(reports, RPT_INFO, "Packed %d files", tot);
else if (verbose)
@@ -275,7 +275,7 @@ static char *find_new_name(char *name)
char tempname[FILE_MAX];
char *newname;
size_t len;
-
+
if (fop_exists(name)) {
for (number = 1; number <= 999; number++) {
BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", name, number);
@@ -300,12 +300,12 @@ int writePackedFile(
char name[FILE_MAX];
char tempname[FILE_MAX];
/* void *data; */
-
+
if (guimode) {} //XXX waitcursor(1);
-
+
BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, ref_file_name);
-
+
if (BLI_exists(name)) {
for (number = 1; number <= 999; number++) {
BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number);
@@ -317,10 +317,10 @@ int writePackedFile(
}
}
}
-
+
/* make sure the path to the file exists... */
BLI_make_existing_file(name);
-
+
file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
if (file == -1) {
BKE_reportf(reports, RPT_ERROR, "Error creating file '%s'", name);
@@ -334,10 +334,10 @@ int writePackedFile(
else {
BKE_reportf(reports, RPT_INFO, "Saved packed file to: %s", name);
}
-
+
close(file);
}
-
+
if (remove_tmp) {
if (ret_value == RET_ERROR) {
if (BLI_rename(tempname, name) != 0) {
@@ -350,7 +350,7 @@ int writePackedFile(
}
}
}
-
+
if (guimode) {} //XXX waitcursor(0);
return (ret_value);
@@ -370,10 +370,10 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile
int ret_val, i, len, file;
char buf[4096];
char name[FILE_MAX];
-
+
BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, ref_file_name);
-
+
if (BLI_stat(name, &st) == -1) {
ret_val = PF_NOFILE;
}
@@ -408,11 +408,11 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile
}
}
}
-
+
close(file);
}
}
-
+
return(ret_val);
}
@@ -430,7 +430,7 @@ char *unpackFile(
{
char *newname = NULL;
const char *temp = NULL;
-
+
if (pf != NULL) {
switch (how) {
case -1:
@@ -484,12 +484,12 @@ char *unpackFile(
printf("unpackFile: unknown return_value %d\n", how);
break;
}
-
+
if (temp) {
newname = BLI_strdup(temp);
}
}
-
+
return newname;
}
@@ -539,7 +539,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how)
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
int ret_value = RET_ERROR;
-
+
if (vfont != NULL) {
unpack_generate_paths(vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname));
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how);
@@ -551,7 +551,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how)
MEM_freeN(newname);
}
}
-
+
return (ret_value);
}
@@ -576,7 +576,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
ret_value = RET_OK;
}
}
-
+
return(ret_value);
}
@@ -633,16 +633,16 @@ int unpackLibraries(Main *bmain, ReportList *reports)
Library *lib;
char *newname;
int ret_value = RET_ERROR;
-
+
for (lib = bmain->library.first; lib; lib = lib->id.next) {
if (lib->packedfile && lib->name[0]) {
-
+
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL);
if (newname != NULL) {
ret_value = RET_OK;
-
+
printf("Unpacked .blend library: %s\n", newname);
-
+
freePackedFile(lib->packedfile);
lib->packedfile = NULL;
@@ -650,24 +650,24 @@ int unpackLibraries(Main *bmain, ReportList *reports)
}
}
}
-
+
return(ret_value);
}
void packLibraries(Main *bmain, ReportList *reports)
{
Library *lib;
-
+
/* test for relativenss */
for (lib = bmain->library.first; lib; lib = lib->id.next)
if (!BLI_path_is_rel(lib->name))
break;
-
+
if (lib) {
BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name);
return;
}
-
+
for (lib = bmain->library.first; lib; lib = lib->id.next)
if (lib->packedfile == NULL)
lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain));
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 46fb7c9f9b3..2c17fa44229 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -160,7 +160,7 @@ Paint *BKE_paint_get_active(Scene *sce)
{
if (sce) {
ToolSettings *ts = sce->toolsettings;
-
+
if (sce->basact && sce->basact->object) {
switch (sce->basact->object->mode) {
case OB_MODE_SCULPT:
@@ -601,7 +601,7 @@ float paint_grid_paint_mask(const GridPaintMask *gpm, unsigned level,
{
int factor = BKE_ccg_factor(level, gpm->level);
int gridsize = BKE_ccg_gridsize(gpm->level);
-
+
return gpm->data[(y * factor) * gridsize + (x * factor)];
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c064f2e5f71..50706a05dc0 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -197,7 +197,7 @@ ParticleSystem *psys_get_current(Object *ob)
if (psys->flag & PSYS_CURRENT)
return psys;
}
-
+
return NULL;
}
short psys_get_current_num(Object *ob)
@@ -210,7 +210,7 @@ short psys_get_current_num(Object *ob)
for (psys = ob->particlesystem.first, i = 0; psys; psys = psys->next, i++)
if (psys->flag & PSYS_CURRENT)
return i;
-
+
return i;
}
void psys_set_current_num(Object *ob, int index)
@@ -348,7 +348,7 @@ void psys_check_group_weights(ParticleSettings *part)
dw = part->dupliweights.first;
while (dw && dw->ob != go->ob)
dw = dw->next;
-
+
if (!dw) {
dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
dw->ob = go->ob;
@@ -387,7 +387,7 @@ int psys_uses_gravity(ParticleSimulationData *sim)
static void fluid_free_settings(SPHFluidSettings *fluid)
{
if (fluid)
- MEM_freeN(fluid);
+ MEM_freeN(fluid);
}
/** Free (or release) any data used by this particle settings (does not free the partsett itself). */
@@ -396,7 +396,7 @@ void BKE_particlesettings_free(ParticleSettings *part)
int a;
BKE_animdata_free((ID *)part, false);
-
+
for (a = 0; a < MAX_MTEX; a++) {
MEM_SAFE_FREE(part->mtex[a]);
}
@@ -407,7 +407,7 @@ void BKE_particlesettings_free(ParticleSettings *part)
curvemapping_free(part->roughcurve);
if (part->twistcurve)
curvemapping_free(part->twistcurve);
-
+
free_partdeflect(part->pd);
free_partdeflect(part->pd2);
@@ -438,7 +438,7 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
psys->pointcache = NULL;
modifier_free((ModifierData *)psys->clmd);
-
+
psys->clmd = NULL;
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
}
@@ -517,10 +517,10 @@ void psys_free_particles(ParticleSystem *psys)
MEM_freeN(pa->hair);
}
}
-
+
if (psys->particles->keys)
MEM_freeN(psys->particles->keys);
-
+
if (psys->particles->boid)
MEM_freeN(psys->particles->boid);
@@ -555,11 +555,11 @@ void psys_free_pdd(ParticleSystem *psys)
}
/* free everything */
void psys_free(Object *ob, ParticleSystem *psys)
-{
+{
if (psys) {
int nr = 0;
ParticleSystem *tpsys;
-
+
psys_free_path_cache(psys, NULL);
free_hair(ob, psys, 1);
@@ -574,7 +574,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
psys->child = NULL;
psys->totchild = 0;
}
-
+
/* check if we are last non-visible particle system */
for (tpsys = ob->particlesystem.first; tpsys; tpsys = tpsys->next) {
if (tpsys->part) {
@@ -592,7 +592,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
BKE_ptcache_free_list(&psys->ptcaches);
psys->pointcache = NULL;
-
+
BLI_freelistN(&psys->targets);
BLI_bvhtree_free(psys->bvhtree);
@@ -680,7 +680,7 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
data = psys->renderdata;
if (!data)
return;
-
+
if (data->elems)
MEM_freeN(data->elems);
@@ -765,7 +765,7 @@ bool psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
if (!(psys->renderdata && (psys->part->simplify_flag & PART_SIMPLIFY_ENABLE)))
return false;
-
+
data = psys->renderdata;
if (!data->do_simplify)
return false;
@@ -822,7 +822,7 @@ static float interpolate_particle_value(float v1, float v2, float v3, float v4,
value += w[3] * v4;
CLAMP(value, 0.f, 1.f);
-
+
return value;
}
@@ -1075,7 +1075,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
while (pind->kkey[1]->time < real_t)
pind->kkey[1]++;
-
+
pind->kkey[0] = pind->kkey[1] - 1;
}
else if (pind->cache) {
@@ -1236,7 +1236,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
if (mface->v4) {
v4 = mvert[mface->v4].co;
normal_short_to_float_v3(n4, mvert[mface->v4].no);
-
+
interp_v3_v3v3v3v3(vec, v1, v2, v3, v4, w);
if (nor) {
@@ -1256,7 +1256,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
normal_tri_v3(nor, v1, v2, v3);
}
}
-
+
/* calculate tangent vectors */
if (utan && vtan) {
if (tface) {
@@ -1364,7 +1364,7 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m
cp1 = (const char *)&mcol[0];
cp2 = (const char *)&mcol[1];
cp3 = (const char *)&mcol[2];
-
+
if (quad) {
cp4 = (char *)&mcol[3];
@@ -1395,7 +1395,7 @@ static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int
MFace *mf = dm->getTessFaceData(dm, index, CD_MFACE);
return interpolate_particle_value(values[mf->v1], values[mf->v2], values[mf->v3], values[mf->v4], fw, mf->v4);
}
-
+
}
return 0.0f;
}
@@ -1418,7 +1418,7 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4
psys_w_to_origspace(w, co);
co[2] = 0.0f;
-
+
if (quad) {
v[3][0] = osface->uv[3][0]; v[3][1] = osface->uv[3][1]; v[3][2] = 0.0f;
interp_weights_poly_v3(neww, v, 4, co);
@@ -1501,7 +1501,7 @@ int psys_particle_dm_face_lookup(
}
psys_w_to_origspace(fw, uv);
-
+
if (poly_nodes) {
/* we can have a restricted linked list of faces to check, faster! */
LinkNode *tessface_node = poly_nodes[pindex_orig];
@@ -1687,7 +1687,7 @@ float psys_particle_value_from_verts(DerivedMesh *dm, short from, ParticleData *
if (!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
return 0.0f;
-
+
return psys_interpolate_value_from_verts(dm, from, mapindex, mapfw, values);
}
@@ -1764,13 +1764,13 @@ CustomDataMask psys_emitter_customdata_mask(ParticleSystem *psys)
break;
}
}
-
+
/* particles only need this if they are after a non deform modifier, and
* the modifier stack will only create them in that case. */
dataMask |= CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORIGINDEX;
dataMask |= CD_MASK_ORCO;
-
+
return dataMask;
}
@@ -1814,10 +1814,10 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
LOOP_PARTICLES {
psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, state.co, 0, 0, 0, 0, 0);
-
+
mul_m4_v3(sim->ob->obmat, state.co);
mul_mat3_m4_v3(sim->ob->obmat, state.vel);
-
+
pd_point_from_particle(sim, pa, &state, &point);
for (eff = effectors->first; eff; eff = eff->next) {
@@ -1855,22 +1855,22 @@ int do_guides(ParticleSettings *part, ListBase *effectors, ParticleKey *state, i
if (effectors) for (eff = effectors->first; eff; eff = eff->next) {
pd = eff->pd;
-
+
if (pd->forcefield != PFIELD_GUIDE)
continue;
-
+
data = eff->guide_data + index;
-
+
if (data->strength <= 0.0f)
continue;
-
+
guidetime = time / (1.0f - pd->free_end);
-
+
if (guidetime > 1.0f)
continue;
-
+
cu = (Curve *)eff->ob->data;
-
+
if (pd->flag & PFIELD_GUIDE_PATH_ADD) {
if (where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight) == 0)
return 0;
@@ -1879,14 +1879,14 @@ int do_guides(ParticleSettings *part, ListBase *effectors, ParticleKey *state, i
if (where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight) == 0)
return 0;
}
-
+
mul_m4_v3(eff->ob->obmat, guidevec);
mul_mat3_m4_v3(eff->ob->obmat, guidedir);
-
+
normalize_v3(guidedir);
-
+
copy_v3_v3(vec_to_point, data->vec_to_point);
-
+
if (guidetime != 0.0f) {
/* curve direction */
cross_v3_v3v3(temp, eff->guide_dir, guidedir);
@@ -1894,52 +1894,52 @@ int do_guides(ParticleSettings *part, ListBase *effectors, ParticleKey *state, i
angle = saacos(angle);
axis_angle_to_quat(rot2, temp, angle);
mul_qt_v3(rot2, vec_to_point);
-
+
/* curve tilt */
axis_angle_to_quat(rot2, guidedir, guidevec[3] - eff->guide_loc[3]);
mul_qt_v3(rot2, vec_to_point);
}
-
+
/* curve taper */
if (cu->taperobj)
mul_v3_fl(vec_to_point, BKE_displist_calc_taper(eff->scene, cu->taperobj, (int)(data->strength * guidetime * 100.0f), 100));
-
+
else { /* curve size*/
if (cu->flag & CU_PATH_RADIUS) {
mul_v3_fl(vec_to_point, radius);
}
}
-
+
if (clumpcurve)
curvemapping_changed_all(clumpcurve);
if (roughcurve)
curvemapping_changed_all(roughcurve);
-
+
{
ParticleKey key;
float par_co[3] = {0.0f, 0.0f, 0.0f};
float par_vel[3] = {0.0f, 0.0f, 0.0f};
float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
float orco_offset[3] = {0.0f, 0.0f, 0.0f};
-
+
copy_v3_v3(key.co, vec_to_point);
do_kink(&key, par_co, par_vel, par_rot, guidetime, pd->kink_freq, pd->kink_shape, pd->kink_amp, 0.f, pd->kink, pd->kink_axis, 0, 0);
do_clump(&key, par_co, guidetime, orco_offset, pd->clump_fac, pd->clump_pow, 1.0f,
part->child_flag & PART_CHILD_USE_CLUMP_NOISE, part->clump_noise_size, clumpcurve);
copy_v3_v3(vec_to_point, key.co);
}
-
+
add_v3_v3(vec_to_point, guidevec);
-
+
//sub_v3_v3v3(pa_loc, pa_loc, pa_zero);
madd_v3_v3fl(effect, vec_to_point, data->strength);
madd_v3_v3fl(veffect, guidedir, data->strength);
totstrength += data->strength;
-
+
if (pd->flag & PFIELD_GUIDE_PATH_WEIGHT)
totstrength *= weight;
}
-
+
if (totstrength != 0.0f) {
if (totstrength > 1.0f)
mul_v3_fl(effect, 1.0f / totstrength);
@@ -2096,7 +2096,7 @@ static bool psys_thread_context_init_path(
if (totchild && part->childtype == PART_CHILD_FACES) {
totparent = (int)(totchild * part->parents * 0.3f);
-
+
if ((psys->renderdata || use_render_params) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
@@ -2170,7 +2170,7 @@ static void psys_task_init_path(ParticleTask *task, ParticleSimulationData *sim)
{
/* init random number generator */
int seed = 31415926 + sim->psys->seed;
-
+
task->rng_path = BLI_rng_new(seed);
}
@@ -2277,7 +2277,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp
/* get the original coordinates (orco) for texture usage */
cpa_num = cpa->num;
-
+
foffset = cpa->foffset;
cpa_fuv = cpa->fuv;
cpa_from = PART_FROM_FACE;
@@ -2426,14 +2426,14 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp
if (pa->flag & PARS_UNEXIST) pa = NULL;
}
-
+
if (pa) {
ListBase modifiers;
BLI_listbase_clear(&modifiers);
-
+
psys_particle_on_emitter(ctx->sim.psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset,
par_co, NULL, NULL, NULL, par_orco, NULL);
-
+
psys_apply_child_modifiers(ctx, &modifiers, cpa, &ptex, orco, ornor, hairmat, child_keys, par, par_orco);
}
else
@@ -2471,57 +2471,57 @@ void psys_cache_child_paths(
ParticleTask *tasks_parent, *tasks_child;
int numtasks_parent, numtasks_child;
int i, totchild, totparent;
-
+
if (sim->psys->flag & PSYS_GLOBAL_HAIR)
return;
-
+
/* create a task pool for child path tasks */
if (!psys_thread_context_init_path(&ctx, sim, sim->scene, cfra, editupdate, use_render_params))
return;
-
+
task_scheduler = BLI_task_scheduler_get();
task_pool = BLI_task_pool_create(task_scheduler, &ctx);
totchild = ctx.totchild;
totparent = ctx.totparent;
-
+
if (editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) {
; /* just overwrite the existing cache */
}
else {
/* clear out old and create new empty path cache */
free_child_path_cache(sim->psys);
-
+
sim->psys->childcache = psys_alloc_path_cache_buffers(&sim->psys->childcachebufs, totchild, ctx.segments + ctx.extra_segments + 1);
sim->psys->totchildcache = totchild;
}
-
+
/* cache parent paths */
ctx.parent_pass = 1;
psys_tasks_create(&ctx, 0, totparent, &tasks_parent, &numtasks_parent);
for (i = 0; i < numtasks_parent; ++i) {
ParticleTask *task = &tasks_parent[i];
-
+
psys_task_init_path(task, sim);
BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW);
}
BLI_task_pool_work_and_wait(task_pool);
-
+
/* cache child paths */
ctx.parent_pass = 0;
psys_tasks_create(&ctx, totparent, totchild, &tasks_child, &numtasks_child);
for (i = 0; i < numtasks_child; ++i) {
ParticleTask *task = &tasks_child[i];
-
+
psys_task_init_path(task, sim);
BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW);
}
BLI_task_pool_work_and_wait(task_pool);
BLI_task_pool_free(task_pool);
-
+
psys_tasks_free(tasks_parent, numtasks_parent);
psys_tasks_free(tasks_child, numtasks_child);
-
+
psys_thread_context_free(&ctx);
}
@@ -2577,15 +2577,15 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
ParticleCacheKey *ca, **cache;
DerivedMesh *hair_dm = (psys->part->type == PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS) ? psys->hair_out_dm : NULL;
-
+
ParticleKey result;
-
+
Material *ma;
ParticleInterpolationData pind;
ParticleTexture ptex;
PARTICLE_P;
-
+
float birthtime = 0.0, dietime = 0.0;
float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/;
float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
@@ -2622,7 +2622,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
if ((psys->flag & PSYS_GLOBAL_HAIR) == 0) {
if ((psys->part->flag & PART_CHILD_EFFECT) == 0)
vg_effector = psys_cache_vgroup(psmd->dm_final, psys, PSYS_VG_EFFECTOR);
-
+
if (!psys->totchild)
vg_length = psys_cache_vgroup(psmd->dm_final, psys, PSYS_VG_LENGTH);
}
@@ -2697,7 +2697,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
if (part->type == PART_HAIR) {
HairKey *hkey;
-
+
for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey) {
mul_v3_m4v3(hkey->world_co, hairmat, hkey->co);
}
@@ -2775,7 +2775,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 = NULL;
PTCacheEditKey *ekey = NULL;
@@ -2785,7 +2785,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleInterpolationData pind;
ParticleKey result;
-
+
float birthtime = 0.0f, dietime = 0.0f;
float t, time = 0.0f, keytime = 0.0f /*, frs_sec */;
float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
@@ -3060,7 +3060,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
sub_v3_v3v3(mat[1], v2, v1);
normalize_v3(mat[1]);
}
-
+
/* third as a cross product */
cross_v3_v3v3(mat[0], mat[1], mat[2]);
}
@@ -3077,7 +3077,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
mface = dm->getTessFaceData(dm, i, CD_MFACE);
osface = dm->getTessFaceData(dm, i, CD_ORIGSPACE);
-
+
if (orco && (orcodata = dm->getVertDataArray(dm, CD_ORCO))) {
copy_v3_v3(v[0], orcodata[mface->v1]);
copy_v3_v3(v[1], orcodata[mface->v2]);
@@ -3106,7 +3106,7 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa
unit_m4(hairmat);
return;
}
-
+
psys_face_mat(0, dm, pa, hairmat, 0);
psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
copy_v3_v3(hairmat[3], vec);
@@ -3255,7 +3255,7 @@ static void default_particle_settings(ParticleSettings *part)
part->grid_res = 10;
part->timetweak = 1.0;
part->courant_target = 0.2;
-
+
part->integrator = PART_INT_MIDPOINT;
part->phystype = PART_PHYS_NEWTON;
part->hair_step = 5;
@@ -3326,7 +3326,7 @@ ParticleSettings *BKE_particlesettings_add(Main *bmain, const char *name)
ParticleSettings *part;
part = BKE_libblock_alloc(bmain, ID_PA, name, 0);
-
+
default_particle_settings(part);
return part;
@@ -3335,24 +3335,24 @@ ParticleSettings *BKE_particlesettings_add(Main *bmain, const char *name)
void BKE_particlesettings_clump_curve_init(ParticleSettings *part)
{
CurveMapping *cumap = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
-
+
cumap->cm[0].curve[0].x = 0.0f;
cumap->cm[0].curve[0].y = 1.0f;
cumap->cm[0].curve[1].x = 1.0f;
cumap->cm[0].curve[1].y = 1.0f;
-
+
part->clumpcurve = cumap;
}
void BKE_particlesettings_rough_curve_init(ParticleSettings *part)
{
CurveMapping *cumap = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
-
+
cumap->cm[0].curve[0].x = 0.0f;
cumap->cm[0].curve[0].y = 1.0f;
cumap->cm[0].curve[1].x = 1.0f;
cumap->cm[0].curve[1].y = 1.0f;
-
+
part->roughcurve = cumap;
}
@@ -3427,7 +3427,7 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int index, const f
MFace *mf;
MTFace *tf;
int i;
-
+
tf = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, name);
if (tf == NULL)
@@ -3624,7 +3624,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
ATTR_FALLTHROUGH;
case TEXCO_ORCO:
psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, 0, 0, 0, texvec, 0);
-
+
if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
BKE_mesh_texspace_calc(me);
}
@@ -3720,7 +3720,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED
{
ParticleSettings *part = psys->part;
float size; // time XXX
-
+
if (part->childtype == PART_CHILD_FACES) {
int w = 0;
size = 0.0;
@@ -3857,7 +3857,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
}
else {
float par_co[3], par_orco[3];
-
+
cpa = psys->child + p - totpart;
if (state->time < 0.0f)
@@ -4134,9 +4134,9 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
/* convert velocity to timestep size */
mul_v3_fl(keys[1].vel, dfra * timestep);
mul_v3_fl(keys[2].vel, dfra * timestep);
-
+
psys_interpolate_particle(-1, keys, keytime, state, 1);
-
+
/* convert back to real velocity */
mul_v3_fl(state->vel, 1.f / (dfra * timestep));
@@ -4162,7 +4162,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (sim->psys->lattice_deform_data)
calc_latt_deform(sim->psys->lattice_deform_data, state->co, psys->lattice_strength);
}
-
+
return 1;
}
}
@@ -4200,7 +4200,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part,
mtface += cpa->num;
psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv);
}
-
+
psys_particle_on_emitter(psmd, PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, loc, 0, 0, 0, orco, 0);
return;
}
@@ -4411,7 +4411,7 @@ void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
mul_m4_v3(imat, hkey->co);
}
}
-
+
end_latt_deform(psys->lattice_deform_data);
psys->lattice_deform_data = NULL;
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index d1c6dbe421c..8a3b1312590 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -94,7 +94,7 @@ static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *fi
for (p=0; p<psys->totpart; p++,cpa++) {
float length=2.0;
cpa->parent=p;
-
+
/* create even spherical distribution inside unit sphere */
while (length>=1.0f) {
cpa->fuv[0]=2.0f*BLI_frand()-1.0f;
@@ -136,7 +136,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
/* determine major axis */
axis = axis_dominant_v3_single(delta);
-
+
d = delta[axis]/(float)res;
size[axis] = res;
@@ -198,7 +198,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
totface=dm->getNumTessFaces(dm);
mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
-
+
for (a=0; a<amax; a++) {
if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
else if (a==1) { a0mul=res; a1mul=1; a2mul=res*res; }
@@ -350,13 +350,13 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
x= 0;
num2 = 2 * num;
for (i=0; i<num2; i+=2) {
-
+
jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng));
jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - BLI_rng_get_float(rng));
-
+
jit[i]-= (float)floor(jit[i]);
jit[i+1]-= (float)floor(jit[i+1]);
-
+
x+= rad3;
x -= (float)floor(x);
}
@@ -417,10 +417,10 @@ static int distribute_binary_search(float *sum, int n, float value)
while (low < high) {
mid = (low + high) / 2;
-
+
if ((sum[mid] >= value) && (sum[mid - 1] < value))
return mid;
-
+
if (sum[mid] > value) {
high = mid - 1;
}
@@ -472,22 +472,22 @@ static void distribute_from_verts_exec(ParticleTask *thread, ParticleData *pa, i
}
}
}
-
+
#if ONLY_WORKING_WITH_PA_VERTS
if (ctx->tree) {
KDTreeNearest ptn[3];
int w, maxw;
-
+
psys_particle_on_dm(ctx->dm,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0);
BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_nearest_n(ctx->tree,orco1,ptn,3);
-
+
for (w=0; w<maxw; w++) {
pa->verts[w]=ptn->num;
}
}
#endif
-
+
if (rng_skip_tot > 0) /* should never be below zero */
BLI_rng_skip(thread->rng, rng_skip_tot);
}
@@ -501,10 +501,10 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i
int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */
MFace *mface;
-
+
pa->num = i = ctx->index[p];
mface = dm->getTessFaceData(dm,i,CD_MFACE);
-
+
switch (distr) {
case PART_DISTR_JIT:
if (ctx->jitlevel == 1) {
@@ -524,12 +524,12 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i
randu= BLI_rng_get_float(thread->rng);
randv= BLI_rng_get_float(thread->rng);
rng_skip_tot -= 2;
-
+
psys_uv_to_w(randu, randv, mface->v4, pa->fuv);
break;
}
pa->foffset= 0.0f;
-
+
if (rng_skip_tot > 0) /* should never be below zero */
BLI_rng_skip(thread->rng, rng_skip_tot);
}
@@ -542,13 +542,13 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
int distr= ctx->distr;
int i, intersect, tot;
int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */
-
+
MFace *mface;
MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
-
+
pa->num = i = ctx->index[p];
mface = dm->getTessFaceData(dm,i,CD_MFACE);
-
+
switch (distr) {
case PART_DISTR_JIT:
if (ctx->jitlevel == 1) {
@@ -568,30 +568,30 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
randu= BLI_rng_get_float(thread->rng);
randv= BLI_rng_get_float(thread->rng);
rng_skip_tot -= 2;
-
+
psys_uv_to_w(randu, randv, mface->v4, pa->fuv);
break;
}
pa->foffset= 0.0f;
-
+
/* experimental */
tot=dm->getNumTessFaces(dm);
-
+
psys_interpolate_face(mvert,mface,0,0,pa->fuv,co,nor,0,0,0,0);
-
+
normalize_v3(nor);
negate_v3(nor);
-
+
min_d=FLT_MAX;
intersect=0;
-
+
for (i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
if (i==pa->num) continue;
-
+
v1=mvert[mface->v1].co;
v2=mvert[mface->v2].co;
v3=mvert[mface->v3].co;
-
+
if (isect_ray_tri_v3(co, nor, v2, v3, v1, &cur_d, NULL)) {
if (cur_d<min_d) {
min_d=cur_d;
@@ -601,7 +601,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
}
if (mface->v4) {
v4=mvert[mface->v4].co;
-
+
if (isect_ray_tri_v3(co, nor, v4, v1, v3, &cur_d, NULL)) {
if (cur_d<min_d) {
min_d=cur_d;
@@ -623,7 +623,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
break;
}
}
-
+
if (rng_skip_tot > 0) /* should never be below zero */
BLI_rng_skip(thread->rng, rng_skip_tot);
}
@@ -637,40 +637,40 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i
int cfrom= ctx->cfrom;
int i;
int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */
-
+
MFace *mf;
-
+
if (ctx->index[p] < 0) {
cpa->num=0;
cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]=0.0f;
cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0;
return;
}
-
+
mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE);
-
+
randu= BLI_rng_get_float(thread->rng);
randv= BLI_rng_get_float(thread->rng);
rng_skip_tot -= 2;
-
+
psys_uv_to_w(randu, randv, mf->v4, cpa->fuv);
-
+
cpa->num = ctx->index[p];
-
+
if (ctx->tree) {
KDTreeNearest ptn[10];
int w,maxw;//, do_seams;
float maxd /*, mind,dd */, totw= 0.0f;
int parent[10];
float pweight[10];
-
+
psys_particle_on_dm(dm,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,NULL,NULL,orco1,NULL);
BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1);
maxw = BLI_kdtree_find_nearest_n(ctx->tree,orco1,ptn,3);
-
+
maxd=ptn[maxw-1].dist;
/* mind=ptn[0].dist; */ /* UNUSED */
-
+
/* the weights here could be done better */
for (w=0; w<maxw; w++) {
parent[w]=ptn[w].index;
@@ -680,7 +680,7 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i
parent[w]=-1;
pweight[w]=0.0f;
}
-
+
for (w=0,i=0; w<maxw && i<4; w++) {
if (parent[w]>=0) {
cpa->pa[i]=parent[w];
@@ -693,13 +693,13 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i
cpa->pa[i]=-1;
cpa->w[i]=0.0f;
}
-
+
if (totw > 0.0f) {
for (w = 0; w < 4; w++) {
cpa->w[w] /= totw;
}
}
-
+
cpa->parent=cpa->pa[0];
}
@@ -715,7 +715,7 @@ static void exec_distribute_parent(TaskPool * __restrict UNUSED(pool), void *tas
int p;
BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP * task->begin);
-
+
pa= psys->particles + task->begin;
switch (psys->part->from) {
case PART_FROM_FACE:
@@ -739,20 +739,20 @@ static void exec_distribute_child(TaskPool * __restrict UNUSED(pool), void *task
ParticleSystem *psys = task->ctx->sim.psys;
ChildParticle *cpa;
int p;
-
+
/* RNG skipping at the beginning */
cpa = psys->child;
for (p = 0; p < task->begin; ++p, ++cpa) {
if (task->ctx->skip) /* simplification skip */
BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP * task->ctx->skip[p]);
-
+
BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP);
}
-
+
for (; p < task->end; ++p, ++cpa) {
if (task->ctx->skip) /* simplification skip */
BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP * task->ctx->skip[p]);
-
+
distribute_children_exec(task, cpa, p);
}
}
@@ -825,28 +825,28 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
int jitlevel= 1, distr;
float *element_weight=NULL,*jitter_offset=NULL, *vweight=NULL;
float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3];
-
+
if (ELEM(NULL, ob, psys, psys->part))
return 0;
-
+
part=psys->part;
totpart=psys->totpart;
if (totpart==0)
return 0;
-
+
if (!finaldm->deformedOnly && !finaldm->getTessFaceDataArray(finaldm, CD_ORIGINDEX)) {
printf("Can't create particles with the current modifier stack, disable destructive modifiers\n");
// XXX error("Can't paint with the current modifier stack, disable destructive modifiers");
return 0;
}
-
+
/* XXX This distribution code is totally broken in case from == PART_FROM_CHILD, it's always using finaldm
* even if use_modifier_stack is unset... But making things consistent here break all existing edited
* hair systems, so better wait for complete rewrite.
*/
psys_thread_context_init(ctx, sim);
-
+
/* First handle special cases */
if (from == PART_FROM_CHILD) {
/* Simple children */
@@ -878,7 +878,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
return 0;
}
}
-
+
/* Create trees and original coordinates if needed */
if (from == PART_FROM_CHILD) {
distr=PART_DISTR_RAND;
@@ -906,7 +906,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
else {
distr = part->distr;
BLI_srandom(31415926 + psys->seed);
-
+
if (psys->part->use_modifier_stack)
dm = finaldm;
else
@@ -964,7 +964,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
MVert *v1, *v2, *v3, *v4;
float totarea=0.f, co1[3], co2[3], co3[3], co4[3];
float (*orcodata)[3];
-
+
orcodata= dm->getVertDataArray(dm, CD_ORCO);
for (i=0; i<totelem; i++) {
@@ -996,7 +996,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
}
cur = mf->v4 ? area_quad_v3(co1, co2, co3, co4) : area_tri_v3(co1, co2, co3);
-
+
if (cur > maxweight)
maxweight = cur;
@@ -1028,7 +1028,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
for (i=0;i<totelem; i++) {
MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
-
+
if (mf->v4) {
tweight += vweight[mf->v4];
tweight /= 4.0f;
@@ -1101,7 +1101,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
}
else {
double step, pos;
-
+
step = (totpart < 2) ? 0.5 : 1.0 / (double)totpart;
/* This is to address tricky issues with vertex-emitting when user tries (and expects) exact 1-1 vert/part
* distribution (see T47983 and its two example files). It allows us to consider pos as
@@ -1145,17 +1145,17 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
/* Create jittering if needed */
if (distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
jitlevel= part->userjit;
-
+
if (jitlevel == 0) {
jitlevel= totpart/totelem;
if (part->flag & PART_EDISTR) jitlevel*= 2; /* looks better in general, not very scientific */
if (jitlevel<3) jitlevel= 3;
}
-
+
jit= MEM_callocN((2+ jitlevel*2)*sizeof(float), "jit");
/* for small amounts of particles we use regular jitter since it looks
- * a bit better, for larger amounts we switch to hammersley sequence
+ * a bit better, for larger amounts we switch to hammersley sequence
* because it is much faster */
if (jitlevel < 25)
init_mv_jit(jit, jitlevel, psys->seed, part->jitfac);
@@ -1192,7 +1192,7 @@ static void psys_task_init_distribute(ParticleTask *task, ParticleSimulationData
{
/* init random number generator */
int seed = 31415926 + sim->psys->seed;
-
+
task->rng = BLI_rng_new(seed);
}
@@ -1204,19 +1204,19 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
ParticleTask *tasks;
DerivedMesh *finaldm = sim->psmd->dm_final;
int i, totpart, numtasks;
-
+
/* create a task pool for distribution tasks */
if (!psys_thread_context_init_distribute(&ctx, sim, from))
return;
-
+
task_scheduler = BLI_task_scheduler_get();
task_pool = BLI_task_pool_create(task_scheduler, &ctx);
-
+
totpart = (from == PART_FROM_CHILD ? sim->psys->totchild : sim->psys->totpart);
psys_tasks_create(&ctx, 0, totpart, &tasks, &numtasks);
for (i = 0; i < numtasks; ++i) {
ParticleTask *task = &tasks[i];
-
+
psys_task_init_distribute(task, sim);
if (from == PART_FROM_CHILD)
BLI_task_pool_push(task_pool, exec_distribute_child, task, false, TASK_PRIORITY_LOW);
@@ -1224,16 +1224,16 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, TASK_PRIORITY_LOW);
}
BLI_task_pool_work_and_wait(task_pool);
-
+
BLI_task_pool_free(task_pool);
-
+
psys_calc_dmcache(sim->ob, finaldm, sim->psmd->dm_deformed, sim->psys);
-
+
if (ctx.dm != finaldm)
ctx.dm->release(ctx.dm);
-
+
psys_tasks_free(tasks, numtasks);
-
+
psys_thread_context_free(&ctx);
}
@@ -1277,12 +1277,12 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
{
ParticleRenderData *data = psys->renderdata;
float co[4], view[3], ortho1[3], ortho2[3], w, dx, dy, radius;
-
+
/* transform to view space */
copy_v3_v3(co, center);
co[3] = 1.0f;
mul_m4_v4(data->viewmat, co);
-
+
/* compute two vectors orthogonal to view vector */
normalize_v3_v3(view, co);
ortho_basis_v3v3_v3(ortho1, ortho2, view);
@@ -1320,7 +1320,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
*viewport *= psys_render_viewport_falloff(vprate, -(co[1] + radius), data->winy);
else if (co[1] - radius > data->winy)
*viewport *= psys_render_viewport_falloff(vprate, (co[1] - radius) - data->winy, data->winy);
-
+
return area;
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 9eaebc2c55c..fd63285ea85 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -238,7 +238,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
}
}
}
-
+
if (psys->particles) {
totsaved=MIN2(psys->totpart,totpart);
/*save old pars*/
@@ -268,7 +268,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
MEM_freeN(psys->particles);
psys_free_pdd(psys);
}
-
+
psys->particles=newpars;
psys->totpart=totpart;
@@ -313,14 +313,14 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform
{
/* use for building derived mesh mapping info:
*
- * node: the allocated links - total derived mesh element count
+ * 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
*/
Mesh *me= (Mesh*)ob->data;
bool use_modifier_stack= psys->part->use_modifier_stack;
PARTICLE_P;
-
+
/* CACHE LOCATIONS */
if (!dm_final->deformedOnly) {
/* Will use later to speed up subsurf/derivedmesh */
@@ -424,7 +424,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform
/* TODO PARTICLE, make the following line unnecessary, each function
* should know to use the num or num_dmcache, set the num_dmcache to
* an invalid value, just in case */
-
+
LOOP_PARTICLES {
pa->num_dmcache = DMCACHE_NOTFOUND;
}
@@ -453,15 +453,15 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P
int numtasks = ceil_ii((endpart - startpart), MAX_PARTICLES_PER_TASK);
float particles_per_task = (float)(endpart - startpart) / (float)numtasks, p, pnext;
int i;
-
+
tasks = MEM_callocN(sizeof(ParticleTask) * numtasks, "ParticleThread");
*r_numtasks = numtasks;
*r_tasks = tasks;
-
+
p = (float)startpart;
for (i = 0; i < numtasks; i++, p = pnext) {
pnext = p + particles_per_task;
-
+
tasks[i].ctx = ctx;
tasks[i].begin = (int)p;
tasks[i].end = min_ii((int)pnext, endpart);
@@ -471,7 +471,7 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P
void psys_tasks_free(ParticleTask *tasks, int numtasks)
{
int i;
-
+
/* threads */
for (i = 0; i < numtasks; ++i) {
if (tasks[i].rng)
@@ -534,7 +534,7 @@ static void initialize_particle_texture(ParticleSimulationData *sim, ParticleDat
ParticleTexture ptex;
psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f);
-
+
switch (part->type) {
case PART_EMITTER:
if (ptex.exist < psys_frand(psys, p + 125)) {
@@ -558,7 +558,7 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa)
{
ParticleSettings *part = sim->psys->part;
float birth_time = (float)(pa - sim->psys->particles) / (float)sim->psys->totpart;
-
+
pa->flag &= ~PARS_UNEXIST;
pa->time = part->sta + (part->end - part->sta) * birth_time;
@@ -617,7 +617,7 @@ static void free_unexisting_particles(ParticleSimulationData *sim)
if (psys->totunexist) {
int newtotpart = psys->totpart - psys->totunexist;
ParticleData *npa, *newpars;
-
+
npa = newpars = MEM_callocN(newtotpart * sizeof(ParticleData), "particles");
for (p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) {
@@ -705,7 +705,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
else
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
-
+
/* get possible textural influence */
psys_get_texture(sim, pa, &ptex, PAMAP_IVEL, cfra);
@@ -713,7 +713,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
/* let's convert: */
/* -location */
mul_m4_v3(ob->obmat, loc);
-
+
/* -normal */
mul_mat3_m4_v3(ob->obmat, nor);
normalize_v3(nor);
@@ -731,10 +731,10 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
copy_v3_v3(utan, nor);
mul_v3_fl(utan,dot_v3v3(vtan,nor));
sub_v3_v3(vtan, utan);
-
+
normalize_v3(vtan);
}
-
+
/* -velocity (boids need this even if there's no random velocity) */
if (part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) {
@@ -755,7 +755,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
mul_mat3_m4_v3(ob->obmat,r_ave);
normalize_v3(r_ave);
}
-
+
/* -rotation */
if (part->randrotfac != 0.0f) {
r_rot[0] = 2.0f * (psys_frand(psys, p + 16) - 0.5f);
@@ -792,7 +792,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
negate_v3_v3(mat[2], r_vel);
normalize_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
-
+
/* apply rotation */
mat3_to_quat_is_ok( q,mat);
copy_qt_qt(state->rot, q);
@@ -811,11 +811,11 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
sub_v3_v3v3(vel, loc, state->co);
mul_v3_fl(vel, part->obfac/dtime);
}
-
+
/* *emitter normal */
if (part->normfac != 0.f)
madd_v3_v3fl(vel, nor, part->normfac);
-
+
/* *emitter tangent */
if (sim->psmd && part->tanfac != 0.f)
madd_v3_v3fl(vel, vtan, part->tanfac);
@@ -844,7 +844,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
/* *particle */
if (part->partfac != 0.f)
madd_v3_v3fl(vel, p_vel, part->partfac);
-
+
mul_v3_v3fl(state->vel, vel, ptex.ivel);
/* -location from emitter */
@@ -883,7 +883,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic
use_global_space = true;
break;
}
-
+
/* create rotation quat */
@@ -992,7 +992,7 @@ static void evaluate_emitter_anim(Scene *scene, Object *ob, float cfra)
{
if (ob->parent)
evaluate_emitter_anim(scene, ob->parent, cfra);
-
+
/* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(scene, ob, cfra);
@@ -1006,7 +1006,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
ParticleTexture ptex;
int p = pa - psys->particles;
part=psys->part;
-
+
/* get precise emitter matrix if particle is born */
if (part->type != PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) {
evaluate_emitter_anim(sim->scene, sim->ob, pa->time);
@@ -1083,7 +1083,7 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float
{
ParticleData *pa;
int p, totpart=sim->psys->totpart;
-
+
for (p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++)
reset_particle(sim, pa, dtime, cfra);
}
@@ -1144,7 +1144,7 @@ static void set_keyed_keys(ParticleSimulationData *sim)
int keyed_flag = 0;
ksim.scene= sim->scene;
-
+
/* no proper targets so let's clear and bail out */
if (psys->totkeyed==0) {
free_keyed_keys(psys);
@@ -1154,16 +1154,16 @@ static void set_keyed_keys(ParticleSimulationData *sim)
if (totpart && psys->particles->totkey != totkeys) {
free_keyed_keys(psys);
-
+
key = MEM_callocN(totpart*totkeys*sizeof(ParticleKey), "Keyed keys");
-
+
LOOP_PARTICLES {
pa->keys = key;
pa->totkey = totkeys;
key += totkeys;
}
}
-
+
psys->flag &= ~PSYS_KEYED;
@@ -1245,17 +1245,17 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ);
need_rebuild = !psys->bvhtree || psys->bvhtree_frame != cfra;
BLI_rw_mutex_unlock(&psys_bvhtree_rwlock);
-
+
if (need_rebuild) {
LOOP_SHOWN_PARTICLES {
totpart++;
}
-
+
BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_WRITE);
-
+
BLI_bvhtree_free(psys->bvhtree);
psys->bvhtree = BLI_bvhtree_new(totpart, 0.0, 4, 6);
-
+
LOOP_SHOWN_PARTICLES {
if (pa->alive == PARS_ALIVE) {
if (pa->state.time == cfra)
@@ -1265,9 +1265,9 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
}
}
BLI_bvhtree_balance(psys->bvhtree);
-
+
psys->bvhtree_frame = cfra;
-
+
BLI_rw_mutex_unlock(&psys_bvhtree_rwlock);
}
}
@@ -1361,7 +1361,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
if (external_acceleration)
add_v3_v3(acceleration, external_acceleration);
-
+
/* calculate next state */
add_v3_v3(states[i].vel, impulse);
@@ -1494,7 +1494,7 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
SPHFluidSettings *fluid = psys->part->fluid;
ParticleData *pa1, *pa2;
ParticleSpring *spring = psys->fluid_springs;
-
+
float h, d, Rij[3], rij, Lij;
int i;
@@ -1587,9 +1587,9 @@ static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, float co[3],
}
else {
BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ);
-
+
BLI_bvhtree_range_query(psys[i]->bvhtree, co, interaction_radius, callback, pfr);
-
+
BLI_rw_mutex_unlock(&psys_bvhtree_rwlock);
}
}
@@ -1769,7 +1769,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
}
}
}
-
+
/* Artificial buoyancy force in negative gravity direction */
if (fluid->buoyancy > 0.f && gravity)
madd_v3_v3fl(force, gravity, fluid->buoyancy * (density-rest_density));
@@ -2516,7 +2516,7 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti
result->uv[0] = u;
-
+
hit = cur;
*t = ct;
}
@@ -2541,7 +2541,7 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti
cur->inside = 0;
ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_vert);
-
+
if (ct >= 0.f && ct < *t) {
*result = *cur;
@@ -2688,7 +2688,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* get exact velocity right before collision */
madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1);
-
+
/* convert collider velocity from 1/framestep to 1/s TODO: here we assume 1 frame step for collision modifier */
mul_v3_fl(pce->vel, col->inv_timestep);
@@ -2705,14 +2705,14 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* angular <-> linear velocity */
if (dynamic_rotation) {
float vr_tan[3], v1_tan[3], ave[3];
-
+
/* linear velocity of particle surface */
cross_v3_v3v3(vr_tan, pce->nor, pa->state.ave);
mul_v3_fl(vr_tan, pa->size);
/* change to coordinates that move with the collision plane */
sub_v3_v3v3(v1_tan, v0_tan, vc_tan);
-
+
/* The resulting velocity is a weighted average of particle cm & surface
* velocity. This weight (related to particle's moment of inertia) could
* be made a parameter for angular <-> linear conversion.
@@ -2775,7 +2775,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
v0[2] = 0.0f;
}
}
-
+
/* re-apply acceleration to final location and velocity */
madd_v3_v3v3fl(pa->state.co, co, v0, dt2);
madd_v3_v3fl(pa->state.co, col->acc, 0.5f*dt2*dt2);
@@ -2784,7 +2784,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
/* make sure particle stays on the right side of the surface */
if (!through) {
distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor);
-
+
if (distance < col->radius + COLLISION_MIN_DISTANCE)
madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
@@ -2885,7 +2885,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
/* 10 iterations to catch multiple collisions */
while (collision_count < PARTICLE_COLLISION_MAX_COLLISIONS) {
if (collision_detect(pa, &col, &hit, sim->colliders)) {
-
+
collision_count++;
if (collision_count == PARTICLE_COLLISION_MAX_COLLISIONS)
@@ -2989,19 +2989,19 @@ static bool psys_hair_use_simulation(ParticleData *pa, float max_length)
* but this can happen in old files when e.g. cutting hair.
*/
const float min_length = 0.1f * max_length;
-
+
HairKey *key;
int k;
-
+
if (pa->totkey < 2)
return false;
-
+
for (k=1, key=pa->hair+1; k<pa->totkey; k++,key++) {
float length = len_v3v3(key->co, (key-1)->co);
if (length < min_length)
return false;
}
-
+
return true;
}
@@ -3012,7 +3012,7 @@ static MDeformVert *hair_set_pinning(MDeformVert *dvert, float weight)
dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight");
dvert->totweight = 1;
}
-
+
dvert->dw->weight = weight;
dvert++;
}
@@ -3034,7 +3034,7 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int
float hairmat[4][4];
float max_length;
float hair_radius;
-
+
dm = *r_dm;
if (!dm) {
*r_dm = dm = CDDM_new(totpoint, totedge, 0, 0, 0);
@@ -3043,12 +3043,12 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int
mvert = CDDM_get_verts(dm);
medge = CDDM_get_edges(dm);
dvert = DM_get_vert_data_layer(dm, CD_MDEFORMVERT);
-
+
hairdata = *r_hairdata;
if (!hairdata) {
*r_hairdata = hairdata = MEM_mallocN(sizeof(ClothHairData) * totpoint, "hair data");
}
-
+
/* calculate maximum segment length */
max_length = 0.0f;
LOOP_PARTICLES {
@@ -3060,12 +3060,12 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int
}
}
}
-
+
psys->clmd->sim_parms->vgroup_mass = 1;
-
+
/* XXX placeholder for more flexible future hair settings */
hair_radius = part->size;
-
+
/* make vgroup for pin roots etc.. */
hair_index = 1;
LOOP_PARTICLES {
@@ -3153,7 +3153,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
int totedge;
float (*deformedVerts)[3];
bool realloc_roots;
-
+
if (!psys->clmd) {
psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
psys->clmd->sim_parms->goalspring = 0.0f;
@@ -3161,7 +3161,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
}
-
+
/* count simulated points */
totpoint = 0;
totedge = 0;
@@ -3172,7 +3172,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
totpoint += pa->totkey + 1; /* +1 for virtual root point */
}
}
-
+
realloc_roots = false; /* whether hair root info array has to be reallocated */
if (psys->hair_in_dm) {
DerivedMesh *dm = psys->hair_in_dm;
@@ -3182,36 +3182,36 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
realloc_roots = true;
}
}
-
+
if (!psys->hair_in_dm || !psys->clmd->hairdata || realloc_roots) {
if (psys->clmd->hairdata) {
MEM_freeN(psys->clmd->hairdata);
psys->clmd->hairdata = NULL;
}
}
-
+
hair_create_input_dm(sim, totpoint, totedge, &psys->hair_in_dm, &psys->clmd->hairdata);
-
+
if (psys->hair_out_dm)
psys->hair_out_dm->release(psys->hair_out_dm);
-
+
psys->clmd->point_cache = psys->pointcache;
/* for hair sim we replace the internal cloth effector weights temporarily
* to use the particle settings
*/
clmd_effweights = psys->clmd->sim_parms->effector_weights;
psys->clmd->sim_parms->effector_weights = psys->part->effector_weights;
-
+
deformedVerts = MEM_mallocN(sizeof(*deformedVerts) * psys->hair_in_dm->getNumVerts(psys->hair_in_dm), "do_hair_dynamics vertexCos");
psys->hair_out_dm = CDDM_copy(psys->hair_in_dm);
psys->hair_out_dm->getVertCos(psys->hair_out_dm, deformedVerts);
-
+
clothModifier_do(psys->clmd, sim->scene, sim->ob, psys->hair_in_dm, deformedVerts);
-
+
CDDM_apply_vert_coords(psys->hair_out_dm, deformedVerts);
-
+
MEM_freeN(deformedVerts);
-
+
/* restore cloth effector weights */
psys->clmd->sim_parms->effector_weights = clmd_effweights;
}
@@ -3260,11 +3260,11 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
PARTICLE_P;
invert_m4_m4(ob->imat, ob->obmat);
-
+
psys->lattice_deform_data= psys_create_lattice_deform_data(sim);
if (psys->totpart==0) return;
-
+
/* save new keys for elements if needed */
LOOP_PARTICLES {
/* first time alloc */
@@ -3417,7 +3417,7 @@ static void dynamics_step_sph_ddr_task_cb_ex(
}
static void dynamics_step_sph_classical_basic_integrate_task_cb_ex(
- void *__restrict userdata,
+ void *__restrict userdata,
const int p,
const ParallelRangeTLS *__restrict UNUSED(tls))
{
@@ -3556,7 +3556,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
{
ParticleTarget *pt = psys->targets.first;
psys_update_particle_bvhtree(psys, cfra);
-
+
for (; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */
if (pt->ob)
psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
@@ -3613,7 +3613,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
LOOP_DYNAMIC_PARTICLES {
/* do global forces & effectors */
basic_integrate(sim, p, pa->state.time, cfra);
-
+
/* deflection */
if (sim->colliders)
collision_check(sim, p, pa->state.time, cfra);
@@ -3627,7 +3627,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
{
LOOP_DYNAMIC_PARTICLES {
bbd.goal_ob = NULL;
-
+
boid_brain(&bbd, p, pa);
if (pa->alive != PARS_DYING) {
@@ -3761,7 +3761,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
float disp, dietime;
psys_update_effectors(sim);
-
+
disp= psys_get_current_display_percentage(psys);
LOOP_PARTICLES {
@@ -3811,7 +3811,7 @@ static void particles_fluid_step(
#ifdef WITH_MOD_FLUID
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim);
-
+
if ( fluidmd && fluidmd->fss) {
FluidsimSettings *fss= fluidmd->fss;
ParticleSettings *part = psys->part;
@@ -3822,7 +3822,7 @@ static void particles_fluid_step(
int p, j, totpart;
int readMask, activeParts = 0, fileParts = 0;
gzFile gzf;
-
+
// XXX if (ob==G.obedit) // off...
// return;
@@ -3831,7 +3831,7 @@ static void particles_fluid_step(
BLI_path_abs(filename, modifier_path_relbase(bmain, sim->ob));
- BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
+ BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
@@ -3839,46 +3839,46 @@ static void particles_fluid_step(
// XXX bad level call elbeemDebugOut(debugStrBuffer);
return;
}
-
+
gzread(gzf, &totpart, sizeof(totpart));
totpart = (use_render_params) ? totpart:(part->disp*totpart) / 100;
-
+
part->totpart= totpart;
part->sta=part->end = 1.0f;
part->lifetime = sim->scene->r.efra + 1;
-
+
/* allocate particles */
realloc_particles(sim, part->totpart);
-
+
// set up reading mask
readMask = fss->typeFlags;
-
+
for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
int ptype=0;
-
- gzread(gzf, &ptype, sizeof( ptype ));
+
+ gzread(gzf, &ptype, sizeof( ptype ));
if (ptype & readMask) {
activeParts++;
-
+
gzread(gzf, &(pa->size), sizeof(float));
-
+
pa->size /= 10.0f;
-
+
for (j=0; j<3; j++) {
float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
+ gzread(gzf, &wrf, sizeof( wrf ));
pa->state.co[j] = wrf;
//fprintf(stderr,"Rj%d ",j);
}
for (j=0; j<3; j++) {
float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
+ gzread(gzf, &wrf, sizeof( wrf ));
pa->state.vel[j] = wrf;
}
-
+
zero_v3(pa->state.ave);
unit_qt(pa->state.rot);
-
+
pa->time = 1.f;
pa->dietime = sim->scene->r.efra + 1;
pa->lifetime = sim->scene->r.efra;
@@ -3888,18 +3888,18 @@ static void particles_fluid_step(
else {
// skip...
for (j=0; j<2*3+1; j++) {
- float wrf; gzread(gzf, &wrf, sizeof( wrf ));
+ float wrf; gzread(gzf, &wrf, sizeof( wrf ));
}
}
fileParts++;
}
gzclose(gzf);
-
+
totpart = psys->totpart = activeParts;
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart,activeParts,fileParts,readMask);
// bad level call
// XXX elbeemDebugOut(debugStrBuffer);
-
+
} // fluid sim particles done
}
#else
@@ -3945,7 +3945,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
pid = &ptcacheid;
BKE_ptcache_id_from_particles(pid, sim->ob, psys);
-
+
BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
/* clear everything on start frame, or when psys needs full reset! */
@@ -3954,7 +3954,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
BKE_ptcache_validate(cache, startframe);
cache->flag &= ~PTCACHE_REDO_NEEDED;
}
-
+
CLAMP(cache_cfra, startframe, endframe);
}
@@ -4063,7 +4063,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
}
}
}
-
+
/* 4. only write cache starting from second frame */
if (pid) {
BKE_ptcache_validate(cache, (int)cache_cfra);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 51d50b061de..6d29646319f 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -133,7 +133,7 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
BB vb;
BB_reset(&vb);
-
+
if (node->flag & PBVH_Leaf) {
PBVHVertexIter vd;
@@ -184,10 +184,10 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis,
for (;; ) {
for (; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++) ;
for (; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--) ;
-
+
if (!(i < j))
return i;
-
+
SWAP(int, prim_indices[i], prim_indices[j]);
i++;
}
@@ -217,7 +217,7 @@ static int partition_indices_material(PBVH *bvh, int lo, int hi)
for (; grid_materials_match(first, &flagmats[indices[i]]); i++) ;
for (; !grid_materials_match(first, &flagmats[indices[j]]); j--) ;
}
-
+
if (!(i < j))
return i;
@@ -389,7 +389,7 @@ static void build_leaf(PBVH *bvh, int node_index, BBC *prim_bbc,
/* Still need vb for searches */
update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count);
-
+
if (bvh->looptri)
build_mesh_leaf_node(bvh, bvh->nodes + node_index);
else {
@@ -1293,7 +1293,7 @@ void BKE_pbvh_get_grid_updates(PBVH *bvh, bool clear, void ***r_gridfaces, int *
}
pbvh_iter_end(&iter);
-
+
const int tot = BLI_gset_len(face_set);
if (tot == 0) {
*r_totface = 0;
@@ -1396,7 +1396,7 @@ void BKE_pbvh_node_mark_normals_update(PBVHNode *node)
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
{
BLI_assert(node->flag & PBVH_Leaf);
-
+
if (fully_hidden)
node->flag |= PBVH_FullyHidden;
else
@@ -1421,7 +1421,7 @@ void BKE_pbvh_node_num_verts(
int *r_uniquevert, int *r_totvert)
{
int tot;
-
+
switch (bvh->type) {
case PBVH_GRIDS:
tot = node->totprim * bvh->gridkey.grid_area;
@@ -2059,7 +2059,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
{
float vmin[3], vmax[3];
PlaneAABBIsect ret = ISECT_INSIDE;
-
+
for (int i = 0; i < 4; ++i) {
for (int axis = 0; axis < 3; ++axis) {
if (planes[i][axis] > 0) {
@@ -2071,7 +2071,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
vmax[axis] = bb_min[axis];
}
}
-
+
if (dot_v3v3(planes[i], vmin) + planes[i][3] > 0)
return ISECT_OUTSIDE;
else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0)
@@ -2087,7 +2087,7 @@ bool BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
/* BKE_pbvh_node_get_BB */
bb_min = node->vb.bmin;
bb_max = node->vb.bmax;
-
+
return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE;
}
@@ -2097,7 +2097,7 @@ bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
/* BKE_pbvh_node_get_BB */
bb_min = node->vb.bmin;
bb_max = node->vb.bmax;
-
+
return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
}
@@ -2322,22 +2322,22 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
const int *vert_indices;
int *grid_indices;
int totgrid, gridsize, uniq_verts, totvert;
-
+
vi->grid = NULL;
vi->no = NULL;
vi->fno = NULL;
vi->mvert = NULL;
-
+
BKE_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids);
BKE_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
BKE_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
vi->key = &bvh->gridkey;
-
+
vi->grids = grids;
vi->grid_indices = grid_indices;
vi->totgrid = (grids) ? totgrid : 1;
vi->gridsize = gridsize;
-
+
if (mode == PBVH_ITER_ALL)
vi->totvert = totvert;
else
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index f96868e99ea..104f8482635 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -121,7 +121,7 @@
/* could be made into a pointcache option */
#define DURIAN_POINTCACHE_LIB_OK 1
-static int ptcache_data_size[] = {
+static int ptcache_data_size[] = {
sizeof(unsigned int), // BPHYS_DATA_INDEX
3 * sizeof(float), // BPHYS_DATA_LOCATION
3 * sizeof(float), // BPHYS_DATA_VELOCITY
@@ -151,7 +151,7 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
/* Custom functions should read these basic elements too! */
if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
error = 1;
-
+
if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
error = 1;
@@ -162,7 +162,7 @@ static int ptcache_basic_header_write(PTCacheFile *pf)
/* Custom functions should write these basic elements too! */
if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
return 0;
-
+
if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
return 0;
@@ -240,7 +240,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo
{
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co);
PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel);
-
+
/* no rotation info, so make something nice up */
if (data[BPHYS_DATA_ROTATION]==NULL) {
vec_to_quat(key->rot, key->vel, OB_NEGX, OB_POSZ);
@@ -316,7 +316,7 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
if (data[BPHYS_DATA_SIZE]) {
PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size);
}
-
+
if (data[BPHYS_DATA_TIMES]) {
float times[3];
PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, &times);
@@ -494,7 +494,7 @@ static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUS
ClothModifierData *clmd= cloth_v;
Cloth *cloth= clmd->clothObject;
ClothVertex *vert = cloth->verts + index;
-
+
if (old_data) {
memcpy(vert->x, data, 3 * sizeof(float));
memcpy(vert->xconst, data + 3, 3 * sizeof(float));
@@ -560,7 +560,7 @@ static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra))
{
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
-
+
if (sds->fluid) {
return sds->base_res[0]*sds->base_res[1]*sds->base_res[2];
}
@@ -577,7 +577,7 @@ static void ptcache_smoke_error(void *smoke_v, const char *message)
#define SMOKE_CACHE_VERSION "1.04"
static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
-{
+{
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
int ret = 0;
@@ -589,7 +589,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ptcache_file_write(pf, &sds->active_fields, 1, sizeof(int));
ptcache_file_write(pf, &sds->res, 3, sizeof(int));
ptcache_file_write(pf, &sds->dx, 1, sizeof(float));
-
+
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
@@ -636,7 +636,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ptcache_file_write(pf, &sds->active_color, 3, sizeof(float));
MEM_freeN(out);
-
+
ret = 1;
}
@@ -679,7 +679,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode);
ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode);
MEM_freeN(out);
-
+
ret = 1;
}
@@ -691,7 +691,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
{
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
-
+
if (sds->fluid) {
const size_t res = sds->res[0] * sds->res[1] * sds->res[2];
const unsigned int out_len = (unsigned int)res * sizeof(float);
@@ -705,7 +705,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
sds->active_color[0] = 0.7f;
sds->active_color[1] = 0.7f;
sds->active_color[2] = 0.7f;
-
+
smoke_export(sds->fluid, &dt, &dx, &dens, NULL, NULL, NULL, &heat, &heatold, &vx, &vy, &vz, NULL, NULL, NULL, &obstacles);
ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
@@ -758,7 +758,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
}
}
- return 1;
+ return 1;
}
static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
@@ -814,13 +814,13 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
}
}
-
+
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
unsigned char *obstacles;
unsigned int out_len = (unsigned int)res * sizeof(float);
-
+
smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
@@ -1195,7 +1195,7 @@ static void ptcache_dynamicpaint_error(void *UNUSED(sd), const char *UNUSED(mess
#define DPAINT_CACHE_VERSION "1.01"
static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
-{
+{
DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v;
int cache_compress = 1;
@@ -1237,7 +1237,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
{
DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v;
char version[4];
-
+
/* version header */
ptcache_file_read(pf, version, 1, sizeof(char) * 4);
if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) {
@@ -1282,13 +1282,13 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUS
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
-
+
if (rbw->objects)
ob = rbw->objects[index];
-
+
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
-
+
if (rbo->type == RBO_TYPE_ACTIVE) {
#ifdef WITH_BULLET
RB_body_get_position(rbo->physics_object, rbo->pos);
@@ -1305,15 +1305,15 @@ static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float UNU
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
-
+
if (rbw->objects)
ob = rbw->objects[index];
-
+
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
-
+
if (rbo->type == RBO_TYPE_ACTIVE) {
-
+
if (old_data) {
memcpy(rbo->pos, data, 3 * sizeof(float));
memcpy(rbo->orn, data + 3, 4 * sizeof(float));
@@ -1329,23 +1329,23 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
-
+
if (rbw->objects)
ob = rbw->objects[index];
-
+
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
-
+
if (rbo->type == RBO_TYPE_ACTIVE) {
ParticleKey keys[4];
ParticleKey result;
float dfra;
-
+
memset(keys, 0, sizeof(keys));
-
+
copy_v3_v3(keys[1].co, rbo->pos);
copy_qt_qt(keys[1].rot, rbo->orn);
-
+
if (old_data) {
memcpy(keys[2].co, data, 3 * sizeof(float));
memcpy(keys[2].rot, data + 3, 4 * sizeof(float));
@@ -1353,13 +1353,13 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl
else {
BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2);
}
-
+
dfra = cfra2 - cfra1;
-
+
/* note: keys[0] and keys[3] unused for type < 1 (crappy) */
psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &result, true);
interp_qt_qtqt(result.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra);
-
+
copy_v3_v3(rbo->pos, result.co);
copy_qt_qt(rbo->orn, result.rot);
}
@@ -1368,7 +1368,7 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl
static int ptcache_rigidbody_totpoint(void *rb_v, int UNUSED(cfra))
{
RigidBodyWorld *rbw = rb_v;
-
+
return rbw->numbodies;
}
@@ -1525,7 +1525,7 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
pid->ob= ob;
pid->calldata= smd;
-
+
pid->type= PTCACHE_TYPE_SMOKE_DOMAIN;
pid->stack_index= sds->point_cache[0]->index;
@@ -1609,9 +1609,9 @@ void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSu
void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *rbw)
{
-
+
memset(pid, 0, sizeof(PTCacheID));
-
+
pid->ob= ob;
pid->calldata= rbw;
pid->type= PTCACHE_TYPE_RIGIDBODY;
@@ -1620,29 +1620,29 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r
pid->ptcaches= &rbw->ptcaches;
pid->totpoint= pid->totwrite= ptcache_rigidbody_totpoint;
pid->error = ptcache_rigidbody_error;
-
+
pid->write_point = ptcache_rigidbody_write;
pid->read_point = ptcache_rigidbody_read;
pid->interpolate_point = ptcache_rigidbody_interpolate;
-
+
pid->write_stream = NULL;
pid->read_stream = NULL;
pid->write_openvdb_stream = NULL;
pid->read_openvdb_stream = NULL;
-
+
pid->write_extra_data = NULL;
pid->read_extra_data = NULL;
pid->interpolate_extra_data = NULL;
-
+
pid->write_header = ptcache_basic_header_write;
pid->read_header = ptcache_basic_header_read;
-
+
pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_ROTATION);
pid->info_types= 0;
-
+
pid->stack_index = pid->cache->index;
-
+
pid->default_step = 1;
pid->max_step = 1;
pid->file_type = PTCACHE_FILE_PTCACHE;
@@ -1665,7 +1665,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
if (psys->part==NULL)
continue;
-
+
/* check to make sure point cache is actually used by the particles */
if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
continue;
@@ -1673,7 +1673,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s
/* hair needs to be included in id-list for cache edit mode to work */
/* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
/* continue; */
-
+
if (psys->part->type == PART_FLUID)
continue;
@@ -1709,7 +1709,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s
}
}
}
-
+
if (scene && ob->rigidbody_object && scene->rigidbody_world) {
pid = MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_rigidbody(pid, ob, scene->rigidbody_world);
@@ -1799,20 +1799,20 @@ static int ptcache_path(PTCacheID *pid, char *filename)
BLI_split_file_part(blendfilename, file, sizeof(file));
i = strlen(file);
-
+
/* remove .blend */
if (i > 6)
file[i-6] = '\0';
-
+
BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
BLI_path_abs(filename, blendfilename);
return BLI_add_slash(filename); /* new strlen() */
}
-
+
/* use the temp path. this is weak but better then not using point cache at all */
/* temporary directory is assumed to exist and ALWAYS has a trailing slash */
BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH, BKE_tempdir_session());
-
+
return BLI_add_slash(filename); /* new strlen() */
}
@@ -1823,9 +1823,9 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
char *newname;
filename[0] = '\0';
newname = filename;
-
+
if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return 0; /* save blend file before using disk pointcache */
-
+
/* start with temp dir */
if (do_path) {
len = ptcache_path(pid, filename);
@@ -1841,8 +1841,8 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
}
}
else {
- int temp = (int)strlen(pid->cache->name);
- strcpy(newname, pid->cache->name);
+ int temp = (int)strlen(pid->cache->name);
+ strcpy(newname, pid->cache->name);
newname+=temp;
len += temp;
}
@@ -1864,7 +1864,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
}
len += 16;
}
-
+
return len; /* make sure the above string is always 16 chars */
}
@@ -1881,7 +1881,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
return NULL;
#endif
if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */
-
+
ptcache_filename(pid, filename, cfra, 1, 1);
if (mode==PTCACHE_FILE_READ) {
@@ -1975,7 +1975,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
out_len= LZO_OUT_LEN(in_len);
if (mode == 1) {
LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
-
+
r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);
if (!(r == LZO_E_OK) || (out_len >= in_len))
compressed = 0;
@@ -1985,7 +1985,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
#endif
#ifdef WITH_LZMA
if (mode == 2) {
-
+
r = LzmaCompress(out, &out_len, in, in_len, //assume sizeof(char)==1....
props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2);
@@ -1995,7 +1995,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
compressed = 2;
}
#endif
-
+
ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char));
if (compressed) {
unsigned int size = out_len;
@@ -2031,18 +2031,18 @@ static int ptcache_file_data_read(PTCacheFile *pf)
if ((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i]))
return 0;
}
-
+
return 1;
}
static int ptcache_file_data_write(PTCacheFile *pf)
-{
+{
int i;
for (i=0; i<BPHYS_TOT_DATA; i++) {
if ((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i]))
return 0;
}
-
+
return 1;
}
static int ptcache_file_header_begin_read(PTCacheFile *pf)
@@ -2050,12 +2050,12 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
unsigned int typeflag=0;
int error=0;
char bphysics[8];
-
+
pf->data_types = 0;
-
+
if (fread(bphysics, sizeof(char), 8, pf->fp) != 8)
error = 1;
-
+
if (!error && !STREQLEN(bphysics, "BPHYSICS", 8))
error = 1;
@@ -2064,7 +2064,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
pf->type = (typeflag & PTCACHE_TYPEFLAG_TYPEMASK);
pf->flag = (typeflag & PTCACHE_TYPEFLAG_FLAGMASK);
-
+
/* if there was an error set file as it was */
if (error)
fseek(pf->fp, 0, SEEK_SET);
@@ -2075,13 +2075,13 @@ static int ptcache_file_header_begin_write(PTCacheFile *pf)
{
const char *bphysics = "BPHYSICS";
unsigned int typeflag = pf->type + pf->flag;
-
+
if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8)
return 0;
if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp))
return 0;
-
+
return 1;
}
@@ -2362,14 +2362,14 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
if (error && G.debug & G_DEBUG)
printf("Error reading from disk cache\n");
-
+
return pm;
}
static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
{
PTCacheFile *pf = NULL;
unsigned int i, error = 0;
-
+
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm->frame);
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame);
@@ -2384,10 +2384,10 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
pf->totpoint = pm->totpoint;
pf->type = pid->type;
pf->flag = 0;
-
+
if (pm->extradata.first)
pf->flag |= PTCACHE_TYPEFLAG_EXTRADATA;
-
+
if (pid->cache->compression)
pf->flag |= PTCACHE_TYPEFLAG_COMPRESS;
@@ -2443,7 +2443,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
}
ptcache_file_close(pf);
-
+
if (error && G.debug & G_DEBUG)
printf("Error writing to disk cache\n");
@@ -2492,7 +2492,7 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra)
}
ptcache_file_close(pf);
-
+
return error == 0;
}
@@ -2537,7 +2537,7 @@ static int ptcache_read(PTCacheID *pid, int cfra)
}
else {
pm = pid->cache->mem_cache.first;
-
+
while (pm && pm->frame != cfra)
pm = pm->next;
}
@@ -2562,7 +2562,7 @@ static int ptcache_read(PTCacheID *pid, int cfra)
index = pm->cur[BPHYS_DATA_INDEX];
pid->read_point(*index, pid->calldata, pm->cur, (float)pm->frame, NULL);
-
+
BKE_ptcache_mem_pointers_incr(pm);
}
@@ -2591,7 +2591,7 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
}
else {
pm = pid->cache->mem_cache.first;
-
+
while (pm && pm->frame != cfra2)
pm = pm->next;
}
@@ -2729,7 +2729,7 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
{
PTCacheFile *pf = NULL;
int error = 0;
-
+
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, cfra);
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra);
@@ -2801,7 +2801,7 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
while (fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra))
fra--;
-
+
pm2 = ptcache_disk_frame_to_mem(pid, fra);
}
else
@@ -2949,7 +2949,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
unsigned int sta, end;
/* mode is same as fopen's modes */
- DIR *dir;
+ DIR *dir;
struct dirent *de;
char path[MAX_PTCACHE_PATH];
char filename[MAX_PTCACHE_FILE];
@@ -2982,11 +2982,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
case PTCACHE_CLEAR_AFTER:
if (pid->cache->flag & PTCACHE_DISK_CACHE) {
ptcache_path(pid, path);
-
+
dir = opendir(path);
if (dir==NULL)
return;
-
+
len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */
/* append underscore terminator to ensure we don't match similar names
* from objects whose names start with the same prefix
@@ -2995,9 +2995,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
BLI_strncpy(filename + len, "_", sizeof(filename) - 2 - len);
len += 1;
}
-
+
BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext);
-
+
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
@@ -3014,7 +3014,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) ||
(mode == PTCACHE_CLEAR_AFTER && frame > cfra))
{
-
+
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, false, false);
if (pid->cache->cached_frames && frame >=sta && frame <= end)
@@ -3043,7 +3043,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
BLI_freelistN(&pid->cache->mem_cache);
- if (pid->cache->cached_frames)
+ if (pid->cache->cached_frames)
memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
}
else {
@@ -3065,7 +3065,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
}
break;
-
+
case PTCACHE_CLEAR_FRAME:
if (pid->cache->flag & PTCACHE_DISK_CACHE) {
if (BKE_ptcache_id_exist(pid, cfra)) {
@@ -3102,10 +3102,10 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
if (pid->cache->cached_frames && pid->cache->cached_frames[cfra-pid->cache->startframe]==0)
return 0;
-
+
if (pid->cache->flag & PTCACHE_DISK_CACHE) {
char filename[MAX_PTCACHE_FILE];
-
+
ptcache_filename(pid, filename, cfra, 1, 1);
return BLI_exists(filename);
@@ -3145,7 +3145,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if (timescale) {
time= BKE_scene_frame_get(scene);
nexttime = BKE_scene_frame_get_from_ctime(scene, CFRA + 1.0f);
-
+
*timescale= MAX2(nexttime - time, 0.0f);
}
@@ -3183,7 +3183,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if (pid->cache->flag & PTCACHE_DISK_CACHE) {
/* mode is same as fopen's modes */
- DIR *dir;
+ DIR *dir;
struct dirent *de;
char path[MAX_PTCACHE_PATH];
char filename[MAX_PTCACHE_FILE];
@@ -3191,9 +3191,9 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
unsigned int len; /* store the length of the string */
ptcache_path(pid, path);
-
+
len = ptcache_filename(pid, filename, (int)cfra, 0, 0); /* no path */
-
+
dir = opendir(path);
if (dir==NULL)
return;
@@ -3201,7 +3201,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
const char *fext = ptcache_file_extension(pid);
BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext);
-
+
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
@@ -3309,7 +3309,7 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
/* particles or cloth in that case -jahka */
else if (psys->clmd) {
BKE_ptcache_id_from_cloth(&pid, ob, psys->clmd);
- if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED)))
+ if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED)))
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
else
skip = 1;
@@ -3366,19 +3366,19 @@ void BKE_ptcache_remove(void)
char path[MAX_PTCACHE_PATH];
char path_full[MAX_PTCACHE_PATH];
int rmdir = 1;
-
+
ptcache_path(NULL, path);
if (BLI_exists(path)) {
/* The pointcache dir exists? - remove all pointcache */
- DIR *dir;
+ DIR *dir;
struct dirent *de;
dir = opendir(path);
if (dir==NULL)
return;
-
+
while ((de = readdir(dir)) != NULL) {
if (FILENAME_IS_CURRPAR(de->d_name)) {
/* do nothing */
@@ -3397,7 +3397,7 @@ void BKE_ptcache_remove(void)
else {
rmdir = 0; /* path dosnt exist */
}
-
+
if (rmdir) {
BLI_delete(path, true, false);
}
@@ -3507,7 +3507,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcach
return ptcaches_new->first;
}
-/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on
+/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on
* every user action changing stuff, and then it runs a complete bake??? (ton) */
/* Baking */
@@ -3553,7 +3553,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
int startframe = MAXFRAME, endframe = baker->anim_init ? scene->r.sfra : CFRA;
int bake = baker->bake;
int render = baker->render;
-
+
G.is_break = false;
/* set caches to baking mode and figure out start frame */
@@ -3745,7 +3745,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
scene->r.framelen = frameleno;
CFRA = cfrao;
-
+
if (bake) { /* already on cfra unless baking */
BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay);
}
@@ -3827,7 +3827,7 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
cache->flag ^= PTCACHE_DISK_CACHE;
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
cache->flag ^= PTCACHE_DISK_CACHE;
-
+
cache->last_exact = last_exact;
BKE_ptcache_id_time(pid, NULL, 0.0f, NULL, NULL, NULL);
@@ -3847,7 +3847,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
char old_name[80];
int len; /* store the length of the string */
/* mode is same as fopen's modes */
- DIR *dir;
+ DIR *dir;
struct dirent *de;
char path[MAX_PTCACHE_PATH];
char old_filename[MAX_PTCACHE_FILE];
@@ -3906,7 +3906,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
int end = -1;
/* mode is same as fopen's modes */
- DIR *dir;
+ DIR *dir;
struct dirent *de;
char path[MAX_PTCACHE_PATH];
char filename[MAX_PTCACHE_FILE];
@@ -3916,9 +3916,9 @@ void BKE_ptcache_load_external(PTCacheID *pid)
return;
ptcache_path(pid, path);
-
+
len = ptcache_filename(pid, filename, 1, 0, 0); /* no path */
-
+
dir = opendir(path);
if (dir==NULL)
return;
@@ -3929,7 +3929,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
BLI_snprintf(ext, sizeof(ext), "_%02d%s", cache->index, fext);
else
BLI_strncpy(ext, fext, sizeof(ext));
-
+
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
@@ -3985,7 +3985,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
if (pf) {
while (ptcache_file_read(pf, old_data, 1, elemsize))
cache->totpoint++;
-
+
ptcache_file_close(pf);
}
}
@@ -4063,7 +4063,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
}
bytes += sizeof(PTCacheMem);
-
+
totframes++;
}
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index b163f623d21..cb297744ab8 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -50,10 +50,10 @@
void BKE_bproperty_free(bProperty *prop)
{
-
+
if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
MEM_freeN(prop);
-
+
}
void BKE_bproperty_free_list(ListBase *lb)
@@ -68,7 +68,7 @@ void BKE_bproperty_free_list(ListBase *lb)
bProperty *BKE_bproperty_copy(const bProperty *prop)
{
bProperty *propn;
-
+
propn = MEM_dupallocN(prop);
if (prop->poin && prop->poin != &prop->data) {
propn->poin = MEM_dupallocN(prop->poin);
@@ -90,19 +90,19 @@ void BKE_bproperty_copy_list(ListBase *lbn, const ListBase *lbo)
BLI_addtail(lbn, propn);
prop = prop->next;
}
-
-
+
+
}
void BKE_bproperty_init(bProperty *prop)
{
/* also use when property changes type */
-
+
if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
prop->poin = NULL;
-
+
prop->data = 0;
-
+
switch (prop->type) {
case GPROP_BOOL:
case GPROP_INT:
@@ -125,7 +125,7 @@ bProperty *BKE_bproperty_new(int type)
prop->type = type;
BKE_bproperty_init(prop);
-
+
strcpy(prop->name, "prop");
return prop;
@@ -156,7 +156,7 @@ int BKE_bproperty_cmp(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
float fvalue, ftest;
-
+
switch (prop->type) {
case GPROP_BOOL:
if (BLI_strcasecmp(str, "true") == 0) {
@@ -168,7 +168,7 @@ int BKE_bproperty_cmp(bProperty *prop, const char *str)
else return 1;
}
/* no break, do GPROP_int too! */
-
+
case GPROP_INT:
return prop->data - atoi(str);
@@ -185,7 +185,7 @@ int BKE_bproperty_cmp(bProperty *prop, const char *str)
case GPROP_STRING:
return strcmp(prop->poin, str);
}
-
+
return 0;
}
#endif
@@ -211,7 +211,7 @@ void BKE_bproperty_set(bProperty *prop, const char *str)
strcpy(prop->poin, str); /* TODO - check size? */
break;
}
-
+
}
void BKE_bproperty_add(bProperty *prop, const char *str)
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 67b076c0153..a9b36a85602 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -270,10 +270,10 @@ char *BKE_reports_string(ReportList *reports, ReportType level)
void BKE_reports_print(ReportList *reports, ReportType level)
{
char *cstring = BKE_reports_string(reports, level);
-
+
if (cstring == NULL)
return;
-
+
puts(cstring);
fflush(stdout);
MEM_freeN(cstring);
@@ -282,12 +282,12 @@ void BKE_reports_print(ReportList *reports, ReportType level)
Report *BKE_reports_last_displayable(ReportList *reports)
{
Report *report;
-
+
for (report = reports->list.last; report; report = report->prev) {
if (ELEM(report->type, RPT_ERROR, RPT_WARNING, RPT_INFO))
return report;
}
-
+
return NULL;
}
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index ecb8814dd70..502b6a81c76 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -286,7 +286,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
int totvert;
int tottri;
const MLoop *mloop;
-
+
dm = rigidbody_get_mesh(ob);
/* ensure mesh validity, then grab data */
@@ -309,7 +309,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
/* init mesh data for collision shape */
mdata = RB_trimesh_data_new(tottri, totvert);
-
+
RB_trimesh_add_vertices(mdata, (float *)mvert, totvert, sizeof(MVert));
/* loop over all faces, adding them as triangles to the collision shape
@@ -328,7 +328,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
RB_trimesh_add_triangle_indices(mdata, i, UNPACK3(vtri));
}
}
-
+
RB_trimesh_finish(mdata);
/* construct collision shape
@@ -519,21 +519,21 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
const MLoopTri *lt = NULL;
int totvert, tottri = 0;
const MLoop *mloop = NULL;
-
+
/* ensure mesh validity, then grab data */
if (dm == NULL)
return;
-
+
mvert = dm->getVertArray(dm);
totvert = dm->getNumVerts(dm);
lt = dm->getLoopTriArray(dm);
tottri = dm->getNumLoopTri(dm);
mloop = dm->getLoopArray(dm);
-
+
if (totvert > 0 && tottri > 0) {
BKE_mesh_calc_volume(mvert, totvert, lt, tottri, mloop, &volume, NULL);
}
-
+
/* cleanup temp data */
if (ob->rigidbody_object->mesh_source == RBO_MESH_BASE) {
dm->release(dm);
@@ -602,21 +602,21 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3])
const MLoopTri *looptri;
int totvert, tottri;
const MLoop *mloop;
-
+
/* ensure mesh validity, then grab data */
if (dm == NULL)
return;
-
+
mvert = dm->getVertArray(dm);
totvert = dm->getNumVerts(dm);
looptri = dm->getLoopTriArray(dm);
tottri = dm->getNumLoopTri(dm);
mloop = dm->getLoopArray(dm);
-
+
if (totvert > 0 && tottri > 0) {
BKE_mesh_calc_volume(mvert, totvert, looptri, tottri, mloop, NULL, r_center);
}
-
+
/* cleanup temp data */
if (ob->rigidbody_object->mesh_source == RBO_MESH_BASE) {
dm->release(dm);
@@ -1332,7 +1332,7 @@ static void rigidbody_update_simulation(Scene *scene, RigidBodyWorld *rbw, bool
/* XXX TODO For rebuild: remove all constraints first.
* Otherwise we can end up deleting objects that are still
* referenced by constraints, corrupting bullet's internal list.
- *
+ *
* Memory management needs redesign here, this is just a dirty workaround.
*/
if (rebuild && rbw->constraints) {
@@ -1394,7 +1394,7 @@ static void rigidbody_update_simulation(Scene *scene, RigidBodyWorld *rbw, bool
rigidbody_update_sim_ob(scene, rbw, ob, rbo);
}
}
-
+
/* update constraints */
if (rbw->constraints == NULL) /* no constraints, move on */
return;
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index fb81ed4d47f..6f288258a00 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -60,13 +60,13 @@ void free_sensor(bSensor *sens)
if (sens->links) MEM_freeN(sens->links);
if (sens->data) MEM_freeN(sens->data);
MEM_freeN(sens);
-
+
}
void free_sensors(ListBase *lb)
{
bSensor *sens;
-
+
while ((sens = BLI_pophead(lb))) {
free_sensor(sens);
}
@@ -75,7 +75,7 @@ void free_sensors(ListBase *lb)
bSensor *copy_sensor(bSensor *sens, const int UNUSED(flag))
{
bSensor *sensn;
-
+
sensn= MEM_dupallocN(sens);
sensn->flag |= SENS_NEW;
if (sens->data) {
@@ -83,14 +83,14 @@ bSensor *copy_sensor(bSensor *sens, const int UNUSED(flag))
}
if (sens->links) sensn->links= MEM_dupallocN(sens->links);
-
+
return sensn;
}
void copy_sensors(ListBase *lbn, const ListBase *lbo, const int flag)
{
bSensor *sens, *sensn;
-
+
lbn->first= lbn->last= NULL;
sens= lbo->first;
while (sens) {
@@ -107,11 +107,11 @@ void init_sensor(bSensor *sens)
bMouseSensor *ms;
bJoystickSensor *js;
bRaySensor *rs;
-
+
if (sens->data) MEM_freeN(sens->data);
sens->data= NULL;
sens->pulse = 0;
-
+
switch (sens->type) {
case SENS_ALWAYS:
sens->pulse = 0;
@@ -177,12 +177,12 @@ bSensor *new_sensor(int type)
sens= MEM_callocN(sizeof(bSensor), "Sensor");
sens->type= type;
sens->flag= SENS_SHOW;
-
+
init_sensor(sens);
-
+
strcpy(sens->name, "sensor");
// XXX make_unique_prop_names(sens->name);
-
+
return sens;
}
@@ -192,7 +192,7 @@ void unlink_controller(bController *cont)
{
bSensor *sens;
Object *ob;
-
+
/* check for controller pointers in sensors */
ob= G.main->object.first;
while (ob) {
@@ -208,7 +208,7 @@ void unlink_controller(bController *cont)
void unlink_controllers(ListBase *lb)
{
bController *cont;
-
+
for (cont= lb->first; cont; cont= cont->next)
unlink_controller(cont);
}
@@ -220,13 +220,13 @@ void free_controller(bController *cont)
/* the controller itself */
if (cont->data) MEM_freeN(cont->data);
MEM_freeN(cont);
-
+
}
void free_controllers(ListBase *lb)
{
bController *cont;
-
+
while ((cont = BLI_pophead(lb))) {
if (cont->slinks)
MEM_freeN(cont->slinks);
@@ -237,7 +237,7 @@ void free_controllers(ListBase *lb)
bController *copy_controller(bController *cont, const int UNUSED(flag))
{
bController *contn;
-
+
cont->mynew=contn= MEM_dupallocN(cont);
contn->flag |= CONT_NEW;
if (cont->data) {
@@ -247,14 +247,14 @@ bController *copy_controller(bController *cont, const int UNUSED(flag))
if (cont->links) contn->links= MEM_dupallocN(cont->links);
contn->slinks= NULL;
contn->totslinks= 0;
-
+
return contn;
}
void copy_controllers(ListBase *lbn, const ListBase *lbo, const int flag)
{
bController *cont, *contn;
-
+
lbn->first= lbn->last= NULL;
cont= lbo->first;
while (cont) {
@@ -267,10 +267,10 @@ void copy_controllers(ListBase *lbn, const ListBase *lbo, const int flag)
void init_controller(bController *cont)
{
/* also use when controller changes type, leave actuators... */
-
+
if (cont->data) MEM_freeN(cont->data);
cont->data= NULL;
-
+
switch (cont->type) {
case CONT_EXPRESSION:
cont->data= MEM_callocN(sizeof(bExpressionCont), "expcont");
@@ -290,10 +290,10 @@ bController *new_controller(int type)
cont->flag= CONT_SHOW;
init_controller(cont);
-
+
strcpy(cont->name, "cont");
// XXX make_unique_prop_names(cont->name);
-
+
return cont;
}
@@ -303,7 +303,7 @@ void unlink_actuator(bActuator *act)
{
bController *cont;
Object *ob;
-
+
/* check for actuator pointers in controllers */
ob= G.main->object.first;
while (ob) {
@@ -319,7 +319,7 @@ void unlink_actuator(bActuator *act)
void unlink_actuators(ListBase *lb)
{
bActuator *act;
-
+
for (act= lb->first; act; act= act->next)
unlink_actuator(act);
}
@@ -353,7 +353,7 @@ void free_actuator(bActuator *act)
void free_actuators(ListBase *lb)
{
bActuator *act;
-
+
while ((act = BLI_pophead(lb))) {
free_actuator(act);
}
@@ -362,13 +362,13 @@ void free_actuators(ListBase *lb)
bActuator *copy_actuator(bActuator *act, const int flag)
{
bActuator *actn;
-
+
act->mynew=actn= MEM_dupallocN(act);
actn->flag |= ACT_NEW;
if (act->data) {
actn->data= MEM_dupallocN(act->data);
}
-
+
switch (act->type) {
case ACT_ACTION:
case ACT_SHAPEACTION:
@@ -394,7 +394,7 @@ bActuator *copy_actuator(bActuator *act, const int flag)
void copy_actuators(ListBase *lbn, const ListBase *lbo, const int flag)
{
bActuator *act, *actn;
-
+
lbn->first= lbn->last= NULL;
act= lbo->first;
while (act) {
@@ -415,10 +415,10 @@ void init_actuator(bActuator *act)
bArmatureActuator *arma;
bMouseActuator *ma;
bEditObjectActuator *eoa;
-
+
if (act->data) MEM_freeN(act->data);
act->data= NULL;
-
+
switch (act->type) {
case ACT_ACTION:
case ACT_SHAPEACTION:
@@ -523,12 +523,12 @@ bActuator *new_actuator(int type)
act= MEM_callocN(sizeof(bActuator), "Actuator");
act->type= type;
act->flag= ACT_SHOW;
-
+
init_actuator(act);
-
+
strcpy(act->name, "act");
// XXX make_unique_prop_names(act->name);
-
+
return act;
}
@@ -538,7 +538,7 @@ void clear_sca_new_poins_ob(Object *ob)
bSensor *sens;
bController *cont;
bActuator *act;
-
+
sens= ob->sensors.first;
while (sens) {
sens->flag &= ~SENS_NEW;
@@ -561,7 +561,7 @@ void clear_sca_new_poins_ob(Object *ob)
void clear_sca_new_poins(void)
{
Object *ob;
-
+
ob= G.main->object.first;
while (ob) {
clear_sca_new_poins_ob(ob);
@@ -575,7 +575,7 @@ void set_sca_new_poins_ob(Object *ob)
bController *cont;
bActuator *act;
int a;
-
+
sens= ob->sensors.first;
while (sens) {
if (sens->flag & SENS_NEW) {
@@ -597,8 +597,8 @@ void set_sca_new_poins_ob(Object *ob)
}
cont= cont->next;
}
-
-
+
+
act= ob->actuators.first;
while (act) {
if (act->flag & ACT_NEW) {
@@ -649,7 +649,7 @@ void set_sca_new_poins_ob(Object *ob)
void set_sca_new_poins(void)
{
Object *ob;
-
+
ob= G.main->object.first;
while (ob) {
set_sca_new_poins_ob(ob);
@@ -872,7 +872,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
/* locate the controller that has the same state mask but is earlier in the list */
tmp = cont->prev;
while (tmp) {
- if (tmp->state_mask & cont->state_mask)
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->prev;
}
@@ -886,7 +886,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
else if (val == 2 && cont->next) {
tmp = cont->next;
while (tmp) {
- if (tmp->state_mask & cont->state_mask)
+ if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->next;
}
@@ -939,7 +939,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
void link_logicbricks(void **poin, void ***ppoin, short *tot, short size)
{
void **old_links= NULL;
-
+
int ibrick;
/* check if the bricks are already linked */
@@ -953,7 +953,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size)
(*tot) ++;
*ppoin = MEM_callocN((*tot)*size, "new link");
-
+
for (ibrick=0; ibrick < *(tot) - 1; ibrick++) {
(*ppoin)[ibrick] = old_links[ibrick];
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index ca2c683a5ad..a1003910ca3 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -131,10 +131,10 @@ static void remove_sequencer_fcurves(Scene *sce)
if (adt && adt->action) {
FCurve *fcu, *nextfcu;
-
+
for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) {
nextfcu = fcu->next;
-
+
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
action_groups_remove_channel(adt->action, fcu);
free_fcurve(fcu);
@@ -499,14 +499,14 @@ void BKE_scene_free(Scene *sce)
BLI_freelistN(&sce->transform_spaces);
BLI_freelistN(&sce->r.layers);
BLI_freelistN(&sce->r.views);
-
+
BKE_toolsettings_free(sce->toolsettings);
sce->toolsettings = NULL;
-
+
DAG_scene_free(sce);
if (sce->depsgraph)
DEG_graph_free(sce->depsgraph);
-
+
MEM_SAFE_FREE(sce->stats);
MEM_SAFE_FREE(sce->fps_info);
@@ -529,7 +529,7 @@ void BKE_scene_init(Scene *sce)
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(sce, id));
sce->lay = sce->layact = 1;
-
+
sce->r.mode = R_GAMMA | R_OSA | R_SHADOW | R_SSS | R_ENVMAP | R_RAYTRACE;
sce->r.cfra = 1;
sce->r.sfra = 1;
@@ -569,7 +569,7 @@ void BKE_scene_init(Scene *sce)
sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
sce->r.gauss = 1.0;
-
+
/* deprecated but keep for upwards compat */
sce->r.postgamma = 1.0;
sce->r.posthue = 0.0;
@@ -626,7 +626,7 @@ void BKE_scene_init(Scene *sce)
sce->r.border.ymax = 1.0f;
sce->r.preview_start_resolution = 64;
-
+
sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
sce->r.unit_line_thickness = 1.0f;
@@ -762,7 +762,7 @@ void BKE_scene_init(Scene *sce)
sce->gm.gravity = 9.8f;
sce->gm.physicsEngine = WOPHY_BULLET;
- sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling
+ sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling
sce->gm.occlusionRes = 128;
sce->gm.ticrate = 60;
sce->gm.maxlogicstep = 5;
@@ -814,22 +814,22 @@ void BKE_scene_init(Scene *sce)
copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
sce->preview = NULL;
-
+
/* GP Sculpt brushes */
{
GP_BrushEdit_Settings *gset = &sce->toolsettings->gp_sculpt;
GP_EditBrush_Data *gp_brush;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH];
gp_brush->size = 25;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
@@ -839,28 +839,28 @@ void BKE_scene_init(Scene *sce)
gp_brush->size = 50;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH];
gp_brush->size = 25;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST];
gp_brush->size = 50;
gp_brush->strength = 0.3f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH];
gp_brush->size = 50;
gp_brush->strength = 0.5f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
-
+
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
}
-
+
/* GP Stroke Placement */
sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
@@ -912,10 +912,10 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
Group *group;
GroupObject *go;
int flag;
-
+
/* check for cyclic sets, for reading old files but also for definite security (py?) */
BKE_scene_validate_setscene(bmain, scene);
-
+
/* can happen when switching modes in other scenes */
if (scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT))
scene->obedit = NULL;
@@ -941,12 +941,12 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
for (base = scene->base.first; base; base = base->next) {
ob = base->object;
ob->lay = base->lay;
-
+
/* group patch... */
base->flag &= ~(OB_FROMGROUP);
flag = ob->flag & (OB_FROMGROUP);
base->flag |= flag;
-
+
/* not too nice... for recovering objects with lost data */
//if (ob->pose == NULL) base->flag &= ~OB_POSEMODE;
ob->flag = base->flag;
@@ -973,7 +973,7 @@ int BKE_scene_base_iter_next(Main *bmain, EvaluationContext *eval_ctx, SceneBase
Scene **scene, int val, Base **base, Object **ob)
{
bool run_again = true;
-
+
/* init */
if (val == 0) {
iter->phase = F_START;
@@ -1027,19 +1027,19 @@ int BKE_scene_base_iter_next(Main *bmain, EvaluationContext *eval_ctx, SceneBase
}
}
}
-
+
if (*base == NULL) {
iter->phase = F_START;
}
else {
if (iter->phase != F_DUPLI) {
if ( (*base)->object->transflag & OB_DUPLI) {
- /* groups cannot be duplicated for mballs yet,
- * this enters eternal loop because of
+ /* groups cannot be duplicated for mballs yet,
+ * this enters eternal loop because of
* makeDispListMBall getting called inside of group_duplilist */
if ((*base)->object->dup_group == NULL) {
iter->duplilist = object_duplilist_ex(bmain, eval_ctx, (*scene), (*base)->object, false);
-
+
iter->dupob = iter->duplilist->first;
if (!iter->dupob) {
@@ -1072,13 +1072,13 @@ int BKE_scene_base_iter_next(Main *bmain, EvaluationContext *eval_ctx, SceneBase
else if (iter->phase == F_DUPLI) {
iter->phase = F_SCENE;
(*base)->flag &= ~OB_FROMDUPLI;
-
+
if (iter->dupli_refob) {
/* Restore last object's real matrix. */
copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
iter->dupli_refob = NULL;
}
-
+
free_object_duplilist(iter->duplilist);
iter->duplilist = NULL;
run_again = true;
@@ -1099,7 +1099,7 @@ int BKE_scene_base_iter_next(Main *bmain, EvaluationContext *eval_ctx, SceneBase
Object *BKE_scene_camera_find(Scene *sc)
{
Base *base;
-
+
for (base = sc->base.first; base; base = base->next)
if (base->object->type == OB_CAMERA)
return base->object;
@@ -1225,7 +1225,7 @@ void BKE_scene_base_unlink(Scene *sce, Base *base)
/* remove rigid body object from world before removing object */
if (base->object->rigidbody_object)
BKE_rigidbody_remove_object(sce, base->object);
-
+
BLI_remlink(&sce->base, base);
if (sce->basact == base)
sce->basact = NULL;
@@ -1257,7 +1257,7 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
if (sce->set == NULL) return true;
totscene = BLI_listbase_count(&bmain->scene);
-
+
for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
/* more iterations than scenes means we have a cycle */
if (a > totscene) {
@@ -1284,7 +1284,7 @@ float BKE_scene_frame_get_from_ctime(const Scene *scene, const float frame)
float ctime = frame;
ctime += scene->r.subframe;
ctime *= scene->r.framelen;
-
+
return ctime;
}
@@ -1299,7 +1299,7 @@ void BKE_scene_frame_set(struct Scene *scene, double cfra)
}
#ifdef WITH_LEGACY_DEPSGRAPH
-/* drivers support/hacks
+/* drivers support/hacks
* - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render
* - these are always run since the depsgraph can't handle non-object data
* - these happen after objects are all done so that we can read in their final transform values,
@@ -1309,7 +1309,7 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
{
SceneRenderLayer *srl;
float ctime = BKE_scene_frame_get(scene);
-
+
/* scene itself */
if (scene->adt && scene->adt->drivers.first) {
BKE_animsys_evaluate_animdata(scene, &scene->id, scene->adt, ctime, ADT_RECALC_DRIVERS);
@@ -1320,16 +1320,16 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
if (scene->world) {
ID *wid = (ID *)scene->world;
AnimData *adt = BKE_animdata_from_id(wid);
-
+
if (adt && adt->drivers.first)
BKE_animsys_evaluate_animdata(scene, wid, adt, ctime, ADT_RECALC_DRIVERS);
}
-
+
/* nodes */
if (scene->nodetree) {
ID *nid = (ID *)scene->nodetree;
AnimData *adt = BKE_animdata_from_id(nid);
-
+
if (adt && adt->drivers.first)
BKE_animsys_evaluate_animdata(scene, nid, adt, ctime, ADT_RECALC_DRIVERS);
}
@@ -1338,7 +1338,7 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
if (scene->world && scene->world->nodetree) {
ID *nid = (ID *)scene->world->nodetree;
AnimData *adt = BKE_animdata_from_id(nid);
-
+
if (adt && adt->drivers.first)
BKE_animsys_evaluate_animdata(scene, nid, adt, ctime, ADT_RECALC_DRIVERS);
}
@@ -1364,32 +1364,32 @@ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
static void scene_depsgraph_hack(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, Scene *scene_parent)
{
Base *base;
-
+
scene->customdata_mask = scene_parent->customdata_mask;
-
+
/* sets first, we allow per definition current scene to have
* dependencies on sets, but not the other way around. */
if (scene->set)
scene_depsgraph_hack(bmain, eval_ctx, scene->set, scene_parent);
-
+
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
-
+
if (ob->depsflag) {
int recalc = 0;
// printf("depshack %s\n", ob->id.name + 2);
-
+
if (ob->depsflag & OB_DEPS_EXTRA_OB_RECALC)
recalc |= OB_RECALC_OB;
if (ob->depsflag & OB_DEPS_EXTRA_DATA_RECALC)
recalc |= OB_RECALC_DATA;
-
+
ob->recalc |= recalc;
BKE_object_handle_update(bmain, eval_ctx, scene_parent, ob);
-
+
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) {
GroupObject *go;
-
+
for (go = ob->dup_group->gobject.first; go; go = go->next) {
if (go->ob)
go->ob->recalc |= recalc;
@@ -1782,7 +1782,7 @@ static void scene_update_tagged_recursive(EvaluationContext *eval_ctx, Main *bma
/* update masking curves */
BKE_mask_update_scene(bmain, scene);
-
+
}
#endif /* WITH_LEGACY_DEPSGRAPH */
@@ -1868,9 +1868,9 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
DAG_ids_flush_tagged(bmain);
/* removed calls to quick_cache, see pointcache.c */
-
+
/* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
- * when trying to find materials with drivers that need evaluating [#32017]
+ * when trying to find materials with drivers that need evaluating [#32017]
*/
BKE_main_id_tag_idcode(bmain, ID_MA, LIB_TAG_DOIT, false);
BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, false);
@@ -1897,7 +1897,7 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
{
AnimData *adt = BKE_animdata_from_id(&scene->id);
float ctime = BKE_scene_frame_get(scene);
-
+
if (adt && (adt->recalc & ADT_RECALC_ANIM))
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0);
}
@@ -1975,7 +1975,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
/* update animated image textures for particles, modifiers, gpu, etc,
* call this at the start so modifiers with textures don't lag 1 frame */
BKE_image_update_frame(bmain, sce->r.cfra);
-
+
#ifdef WITH_LEGACY_DEPSGRAPH
/* rebuild rigid body worlds before doing the actual frame update
* this needs to be done on start frame but animation playback usually starts one frame later
@@ -1985,9 +1985,9 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
scene_rebuild_rbw_recursive(sce, ctime);
}
#endif
-
+
BKE_sound_set_cfra(sce->r.cfra);
-
+
/* clear animation overrides */
/* XXX TODO... */
@@ -2029,7 +2029,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
#endif
/* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
- * when trying to find materials with drivers that need evaluating [#32017]
+ * when trying to find materials with drivers that need evaluating [#32017]
*/
BKE_main_id_tag_idcode(bmain, ID_MA, LIB_TAG_DOIT, false);
BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, false);
@@ -2041,7 +2041,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
scene_do_rb_simulation_recursive(sce, ctime);
}
#endif
-
+
/* BKE_object_handle_update() on all objects, groups and sets */
#ifdef WITH_LEGACY_DEPSGRAPH
if (use_new_eval) {
@@ -2347,7 +2347,7 @@ int BKE_render_num_threads(const RenderData *rd)
threads = rd->threads;
else
threads = BLI_system_thread_count();
-
+
return max_ii(threads, 1);
}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 995d22c9ba5..3c615221564 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -64,7 +64,7 @@ static void spacetype_free(SpaceType *st)
ARegionType *art;
PanelType *pt;
HeaderType *ht;
-
+
for (art = st->regiontypes.first; art; art = art->next) {
BLI_freelistN(&art->drawcalls);
@@ -83,7 +83,7 @@ static void spacetype_free(SpaceType *st)
BLI_freelistN(&art->paneltypes);
BLI_freelistN(&art->headertypes);
}
-
+
BLI_freelistN(&st->regiontypes);
BLI_freelistN(&st->toolshelf);
@@ -92,18 +92,18 @@ static void spacetype_free(SpaceType *st)
void BKE_spacetypes_free(void)
{
SpaceType *st;
-
+
for (st = spacetypes.first; st; st = st->next) {
spacetype_free(st);
}
-
+
BLI_freelistN(&spacetypes);
}
SpaceType *BKE_spacetype_from_id(int spaceid)
{
SpaceType *st;
-
+
for (st = spacetypes.first; st; st = st->next) {
if (st->spaceid == spaceid)
return st;
@@ -114,11 +114,11 @@ SpaceType *BKE_spacetype_from_id(int spaceid)
ARegionType *BKE_regiontype_from_id_or_first(SpaceType *st, int regionid)
{
ARegionType *art;
-
+
for (art = st->regiontypes.first; art; art = art->next)
if (art->regionid == regionid)
return art;
-
+
printf("Error, region type %d missing in - name:\"%s\", id:%d\n", regionid, st->name, st->spaceid);
return st->regiontypes.first;
}
@@ -126,7 +126,7 @@ ARegionType *BKE_regiontype_from_id_or_first(SpaceType *st, int regionid)
ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
{
ARegionType *art;
-
+
for (art = st->regiontypes.first; art; art = art->next) {
if (art->regionid == regionid) {
return art;
@@ -144,7 +144,7 @@ const ListBase *BKE_spacetypes_list(void)
void BKE_spacetype_register(SpaceType *st)
{
SpaceType *stype;
-
+
/* sanity check */
stype = BKE_spacetype_from_id(st->spaceid);
if (stype) {
@@ -152,7 +152,7 @@ void BKE_spacetype_register(SpaceType *st)
spacetype_free(stype);
MEM_freeN(stype);
}
-
+
BLI_addtail(&spacetypes, st);
}
@@ -167,20 +167,20 @@ void BKE_spacedata_freelist(ListBase *lb)
{
SpaceLink *sl;
ARegion *ar;
-
+
for (sl = lb->first; sl; sl = sl->next) {
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
-
+
/* free regions for pushed spaces */
for (ar = sl->regionbase.first; ar; ar = ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sl->regionbase);
-
- if (st && st->free)
+
+ if (st && st->free)
st->free(sl);
}
-
+
BLI_freelistN(lb);
}
@@ -188,7 +188,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
{
ARegion *newar = MEM_dupallocN(ar);
Panel *pa, *newpa, *patab;
-
+
newar->prev = newar->next = NULL;
BLI_listbase_clear(&newar->handlers);
BLI_listbase_clear(&newar->uiblocks);
@@ -198,7 +198,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
newar->swinid = 0;
newar->regiontimer = NULL;
newar->headerstr = NULL;
-
+
/* use optional regiondata callback */
if (ar->regiondata) {
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
@@ -216,7 +216,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
if (ar->v2d.tab_offset)
newar->v2d.tab_offset = MEM_dupallocN(ar->v2d.tab_offset);
-
+
BLI_listbase_clear(&newar->panels);
BLI_duplicatelist(&newar->panels, &ar->panels);
@@ -236,7 +236,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
pa = pa->next;
}
}
-
+
return newar;
}
@@ -245,10 +245,10 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
{
ARegion *ar;
-
+
/* to be sure */
BLI_listbase_clear(lb1);
-
+
for (ar = lb2->first; ar; ar = ar->next) {
ARegion *arnew = BKE_area_region_copy(st, ar);
BLI_addtail(lb1, arnew);
@@ -260,17 +260,17 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
{
SpaceLink *sl;
-
+
BLI_listbase_clear(lb1); /* to be sure */
-
+
for (sl = lb2->first; sl; sl = sl->next) {
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
-
+
if (st && st->duplicate) {
SpaceLink *slnew = st->duplicate(sl);
-
+
BLI_addtail(lb1, slnew);
-
+
region_copylist(st, &slnew->regionbase, &sl->regionbase);
}
}
@@ -282,14 +282,14 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
void BKE_spacedata_draw_locks(int set)
{
SpaceType *st;
-
+
for (st = spacetypes.first; st; st = st->next) {
ARegionType *art;
-
+
for (art = st->regiontypes.first; art; art = art->next) {
- if (set)
+ if (set)
art->do_lock = art->lock;
- else
+ else
art->do_lock = false;
}
}
@@ -317,16 +317,16 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
if (st) {
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
-
+
if (art && art->free)
art->free(ar);
-
+
if (ar->regiondata)
printf("regiondata free error\n");
}
else if (ar->type && ar->type->free)
ar->type->free(ar);
-
+
if (ar->v2d.tab_offset) {
MEM_freeN(ar->v2d.tab_offset);
ar->v2d.tab_offset = NULL;
@@ -370,14 +370,14 @@ void BKE_screen_area_free(ScrArea *sa)
{
SpaceType *st = BKE_spacetype_from_id(sa->spacetype);
ARegion *ar;
-
+
for (ar = sa->regionbase.first; ar; ar = ar->next)
BKE_area_region_free(st, ar);
BLI_freelistN(&sa->regionbase);
-
+
BKE_spacedata_freelist(&sa->spacedata);
-
+
BLI_freelistN(&sa->actionzones);
}
@@ -388,17 +388,17 @@ void BKE_screen_free(bScreen *sc)
ARegion *ar;
/* No animdata here. */
-
+
for (ar = sc->regionbase.first; ar; ar = ar->next)
BKE_area_region_free(NULL, ar);
BLI_freelistN(&sc->regionbase);
-
+
for (sa = sc->areabase.first; sa; sa = san) {
san = sa->next;
BKE_screen_area_free(sa);
}
-
+
BLI_freelistN(&sc->vertbase);
BLI_freelistN(&sc->edgebase);
BLI_freelistN(&sc->areabase);
@@ -433,7 +433,7 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
{
if (sa) {
ARegion *ar;
-
+
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == type)
return ar;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 0eca7a00515..64c59bd7f2b 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -127,7 +127,7 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1,
else {
out = IMB_allocImBuf(x, y, 32, IB_rect);
}
-
+
if (out->rect_float) {
if (ibuf1 && !ibuf1->rect_float) {
BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true);
@@ -140,7 +140,7 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1,
if (ibuf3 && !ibuf3->rect_float) {
BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true);
}
-
+
IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
}
else {
@@ -369,7 +369,7 @@ static void do_alphaunder_effect_byte(
tempc[1] = (fac * rt1[1] + rt2[1]);
tempc[2] = (fac * rt1[2] + rt2[2]);
tempc[3] = (fac * rt1[3] + rt2[3]);
-
+
premul_float_to_straight_uchar(rt, tempc);
}
}
@@ -384,10 +384,10 @@ static void do_alphaunder_effect_byte(
while (x--) {
straight_uchar_to_premul_float(rt1, cp1);
straight_uchar_to_premul_float(rt2, cp2);
-
+
if (rt2[3] <= 0.0f && fac4 >= 1.0f) *((unsigned int *) rt) = *((unsigned int *) cp1);
else if (rt2[3] >= 1.0f) *((unsigned int *) rt) = *((unsigned int *) cp2);
- else {
+ else {
fac = (fac4 * (1.0f - rt2[3]));
if (fac <= 0) *((unsigned int *)rt) = *((unsigned int *)cp2);
@@ -396,7 +396,7 @@ static void do_alphaunder_effect_byte(
tempc[1] = (fac * rt1[1] + rt2[1]);
tempc[2] = (fac * rt1[2] + rt2[2]);
tempc[3] = (fac * rt1[3] + rt2[3]);
-
+
premul_float_to_straight_uchar(rt, tempc);
}
}
@@ -628,7 +628,7 @@ static float gamma_range_table[RE_GAMMA_TABLE_SIZE + 1];
static float gamfactor_table[RE_GAMMA_TABLE_SIZE];
static float inv_gamma_range_table[RE_GAMMA_TABLE_SIZE + 1];
static float inv_gamfactor_table[RE_GAMMA_TABLE_SIZE];
-static float color_domain_table[RE_GAMMA_TABLE_SIZE + 1];
+static float color_domain_table[RE_GAMMA_TABLE_SIZE + 1];
static float color_step;
static float inv_color_step;
static float valid_gamma;
@@ -642,7 +642,7 @@ static void makeGammaTables(float gamma)
valid_gamma = gamma;
valid_inv_gamma = 1.0f / gamma;
color_step = 1.0f / RE_GAMMA_TABLE_SIZE;
- inv_color_step = (float) RE_GAMMA_TABLE_SIZE;
+ inv_color_step = (float) RE_GAMMA_TABLE_SIZE;
/* We could squeeze out the two range tables to gain some memory */
for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) {
@@ -674,7 +674,7 @@ static float gammaCorrect(float c)
{
int i;
float res;
-
+
i = floorf(c * inv_color_step);
/* Clip to range [0, 1]: outside, just do the complete calculation.
* We may have some performance problems here. Stretching up the LUT
@@ -685,7 +685,7 @@ static float gammaCorrect(float c)
else if (i >= RE_GAMMA_TABLE_SIZE) res = powf(c, valid_gamma);
else res = gamma_range_table[i] +
((c - color_domain_table[i]) * gamfactor_table[i]);
-
+
return res;
}
@@ -710,17 +710,17 @@ static void gamtabs(float gamma)
{
float val, igamma = 1.0f / gamma;
int a;
-
+
/* gamtab: in short, out short */
for (a = 0; a < 65536; a++) {
val = a;
val /= 65535.0f;
-
+
if (gamma == 2.0f)
val = sqrtf(val);
else if (gamma != 1.0f)
val = powf(val, igamma);
-
+
gamtab[a] = (65535.99f * val);
}
/* inverse gamtab1 : in byte, out short */
@@ -1317,7 +1317,7 @@ BLI_INLINE void apply_blend_function_byte(
rt1 = rect1;
rt2 = rect2;
rt = out;
- while (y--) {
+ while (y--) {
for (x = xo; x > 0; x--) {
achannel = rt2[3];
rt2[3] = (unsigned int) achannel * facf0;
@@ -1331,7 +1331,7 @@ BLI_INLINE void apply_blend_function_byte(
if (y == 0) {
break;
}
- y--;
+ y--;
for (x = xo; x > 0; x--) {
achannel = rt2[3];
rt2[3] = (unsigned int) achannel * facf1;
@@ -1356,7 +1356,7 @@ BLI_INLINE void apply_blend_function_float(
rt1 = rect1;
rt2 = rect2;
rt = out;
- while (y--) {
+ while (y--) {
for (x = xo; x > 0; x--) {
achannel = rt2[3];
rt2[3] = achannel * facf0;
@@ -1370,7 +1370,7 @@ BLI_INLINE void apply_blend_function_float(
if (y == 0) {
break;
}
- y--;
+ y--;
for (x = xo; x > 0; x--) {
achannel = rt2[3];
rt2[3] = achannel * facf1;
@@ -1771,7 +1771,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f
/* case DO_CROSS_WIPE: */
/* BOX WIPE IS NOT WORKING YET */
#if 0
- case DO_BOX_WIPE:
+ case DO_BOX_WIPE:
if (!wipe->forward)
facf0 = 1.0f - facf0; /* Go the other direction */
@@ -1852,7 +1852,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f
else output = in_band(hwidth, fabsf(temp2 - pointdist), 1, 1);
if (!wipe->forward) output = 1 - output;
-
+
break;
}
if (output < 0) output = 0;
@@ -2053,7 +2053,7 @@ static void init_transform_effect(Sequence *seq)
transform->yIni = 0.0f;
transform->rotIni = 0.0f;
-
+
transform->interpolation = 1;
transform->percent = 1;
transform->uniform_scale = 0;
@@ -2085,7 +2085,7 @@ static void transform_image(
xo = x;
yo = y;
-
+
/* Rotate */
s = sinf(rotate);
c = cosf(rotate);
@@ -2128,7 +2128,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
{
TransformVars *transform = (TransformVars *) seq->effectdata;
float scale_x, scale_y, translate_x, translate_y, rotate_radians;
-
+
/* Scale */
if (transform->uniform_scale) {
scale_x = scale_y = transform->ScalexIni;
@@ -2292,7 +2292,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, float blur, i
index = (x + (height - 1 - y) * width) * 4;
copy_v4_v4(temp + index, curColor2);
}
-
+
/* Do the main body */
for (y = halfWidth; y < height - halfWidth; y++) {
fy = 0;
@@ -2461,12 +2461,12 @@ static ImBuf *do_glow_effect(
static void init_solid_color(Sequence *seq)
{
SolidColorVars *cv;
-
+
if (seq->effectdata)
MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(SolidColorVars), "solidcolor");
-
+
cv = (SolidColorVars *)seq->effectdata;
cv->col[0] = cv->col[1] = cv->col[2] = 0.5;
}
@@ -2520,7 +2520,7 @@ static ImBuf *do_solid_color(
col1[2] = facf1 * cv->col[2] * 255;
rect = (unsigned char *)out->rect;
-
+
for (y = 0; y < out->y; y++) {
for (x = 0; x < out->x; x++, rect += 4) {
rect[0] = col0[0];
@@ -2553,7 +2553,7 @@ static ImBuf *do_solid_color(
col1[2] = facf1 * cv->col[2];
rect_float = out->rect_float;
-
+
for (y = 0; y < out->y; y++) {
for (x = 0; x < out->x; x++, rect_float += 4) {
rect_float[0] = col0[0];
@@ -2622,7 +2622,7 @@ static ImBuf *do_multicam(
else {
out = i;
}
-
+
return out;
}
@@ -2697,7 +2697,7 @@ static ImBuf *do_adjustment(
else {
out = i;
}
-
+
return out;
}
@@ -2876,7 +2876,7 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for
facf *= seq->seq1->len;
}
facf *= v->globalSpeed;
-
+
if (facf >= seq->seq1->len) {
facf = seq->seq1->len - 1;
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index ed855337041..14119998519 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -746,10 +746,10 @@ void BKE_sequence_calc_disp(Scene *scene, Sequence *seq)
seq->startstill = 0;
if (seq->endofs && seq->endstill)
seq->endstill = 0;
-
+
seq->startdisp = seq->start + seq->startofs - seq->startstill;
seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill;
-
+
seq->handsize = 10.0; /* 10 frames */
if (seq->enddisp - seq->startdisp < 10) {
seq->handsize = (float)(0.5 * (seq->enddisp - seq->startdisp));
@@ -1011,7 +1011,7 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_r
BKE_sequence_tx_set_final_right(seq, prev_enddisp);
BKE_sequence_single_fix(seq);
}
-
+
BKE_sequence_calc(scene, seq);
}
@@ -1275,7 +1275,7 @@ static void multibuf(ImBuf *ibuf, const float fmul)
rt_float[1] *= fmul;
rt_float[2] *= fmul;
rt_float[3] *= fmul;
-
+
rt_float += 4;
}
}
@@ -1306,9 +1306,9 @@ static float give_stripelem_index(Sequence *seq, float cfra)
else if (cfra >= end) nr = end - sta;
else nr = cfra - sta;
}
-
+
if (seq->strobe < 1.0f) seq->strobe = 1.0f;
-
+
if (seq->strobe > 1.0f) {
nr -= fmodf((double)nr, (double)seq->strobe);
}
@@ -1329,7 +1329,7 @@ StripElem *BKE_sequencer_give_stripelem(Sequence *seq, int cfra)
if (nr == -1 || se == NULL)
return NULL;
-
+
se += nr + seq->anim_startofs;
}
return se;
@@ -1426,7 +1426,7 @@ static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequ
}
}
}
-
+
chanshown = b;
for (; b > 0; b--) {
@@ -1656,7 +1656,7 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
return false;
}
- /* MOVIE tracks (only exception: custom files) are now handled
+ /* MOVIE tracks (only exception: custom files) are now handled
* internally by ImBuf module for various reasons: proper time code
* support, quicker index build, using one file instead
* of a full directory of jpeg files, etc. Trying to support old
@@ -2097,7 +2097,7 @@ void BKE_sequencer_proxy_set(struct Sequence *seq, bool value)
}
else {
seq->flag &= ~SEQ_USE_PROXY;
- }
+ }
}
/*********************** color balance *************************/
@@ -2197,7 +2197,7 @@ static void color_balance_byte_byte(StripColorBalance *cb_, unsigned char *rect,
else
p[c] = t;
}
-
+
premul_float_to_straight_uchar(cp, p);
cp += 4;
@@ -2549,7 +2549,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, floa
if (seq->flag & SEQ_FLIPX) {
IMB_flipx(ibuf);
}
-
+
if (seq->flag & SEQ_FLIPY) {
IMB_flipy(ibuf);
}
@@ -2753,7 +2753,7 @@ static ImBuf *seq_render_effect_strip_impl(
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
sh.get_default_fac(seq, cfra, &fac, &facf);
-
+
if ((scene->r.mode & R_FIELDS) == 0)
facf = fac;
}
@@ -3072,7 +3072,7 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence
}
memset(&user, 0, sizeof(MovieClipUser));
-
+
BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame);
user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
@@ -3284,7 +3284,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
BKE_scene_camera_switch_update(scene);
camera = scene->camera;
}
-
+
if (have_comp == false && camera == NULL) {
goto finally;
}
@@ -3666,13 +3666,13 @@ static bool seq_must_swap_input_in_blend_mode(Sequence *seq)
{
bool swap_input = false;
- /* bad hack, to fix crazy input ordering of
+ /* bad hack, to fix crazy input ordering of
* those two effects */
if (ELEM(seq->blend_mode, SEQ_TYPE_ALPHAOVER, SEQ_TYPE_ALPHAUNDER, SEQ_TYPE_OVERDROP)) {
swap_input = true;
}
-
+
return swap_input;
}
@@ -3749,7 +3749,7 @@ static ImBuf *seq_render_strip_stack(
if (out) {
return out;
}
-
+
if (count == 1) {
Sequence *seq = seq_arr[0];
@@ -3874,7 +3874,7 @@ ImBuf *BKE_sequencer_give_ibuf(const SeqRenderData *context, float cfra, int cha
{
Editing *ed = BKE_sequencer_editing_get(context->scene, false);
ListBase *seqbasep;
-
+
if (ed == NULL) return NULL;
if ((chanshown < 0) && !BLI_listbase_is_empty(&ed->metastack)) {
@@ -3925,23 +3925,23 @@ static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER;
-static volatile bool seq_thread_shutdown = true;
+static volatile bool seq_thread_shutdown = true;
static volatile int seq_last_given_monoton_cfra = 0;
static int monoton_cfra = 0;
typedef struct PrefetchThread {
struct PrefetchThread *next, *prev;
-
+
Scene *scene;
struct PrefetchQueueElem *current;
pthread_t pthread;
int running;
-
+
} PrefetchThread;
typedef struct PrefetchQueueElem {
struct PrefetchQueueElem *next, *prev;
-
+
int rectx;
int recty;
float cfra;
@@ -3971,7 +3971,7 @@ void BKE_sequencer_give_ibuf_prefetch_request(const SeqRenderData *context, floa
pthread_mutex_lock(&queue_lock);
BLI_addtail(&prefetch_wait, e);
pthread_mutex_unlock(&queue_lock);
-
+
pthread_mutex_lock(&wakeup_lock);
pthread_cond_signal(&wakeup_cond);
pthread_mutex_unlock(&wakeup_lock);
@@ -4057,7 +4057,7 @@ ImBuf *BKE_sequencer_give_ibuf_threaded(const SeqRenderData *context, float cfra
pthread_mutex_unlock(&frame_done_lock);
}
}
-
+
return e ? e->ibuf : NULL;
}
@@ -4173,30 +4173,30 @@ void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render)
BKE_sequencer_free_imbuf(scene, &seq->seqbase, for_render);
}
if (seq->type == SEQ_TYPE_SCENE) {
- /* FIXME: recurs downwards,
+ /* FIXME: recurs downwards,
* but do recurs protection somehow! */
}
}
-
+
}
static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *changed_seq, int len_change, int ibuf_change)
{
Sequence *subseq;
bool free_imbuf = false;
-
+
/* recurs downwards to see if this seq depends on the changed seq */
-
+
if (seq == NULL)
return false;
-
+
if (seq == changed_seq)
free_imbuf = true;
-
+
for (subseq = seq->seqbase.first; subseq; subseq = subseq->next)
if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
free_imbuf = true;
-
+
if (seq->seq1)
if (update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change))
free_imbuf = true;
@@ -4206,7 +4206,7 @@ static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *cha
if (seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
if (update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change))
free_imbuf = true;
-
+
if (free_imbuf) {
if (ibuf_change) {
if (seq->type == SEQ_TYPE_MOVIE) {
@@ -4216,11 +4216,11 @@ static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *cha
BKE_sequence_effect_speed_rebuild_map(scene, seq, true);
}
}
-
+
if (len_change)
BKE_sequence_calc(scene, seq);
}
-
+
return free_imbuf;
}
@@ -4228,9 +4228,9 @@ void BKE_sequencer_update_changed_seq_and_deps(Scene *scene, Sequence *changed_s
{
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq;
-
+
if (ed == NULL) return;
-
+
for (seq = ed->seqbase.first; seq; seq = seq->next)
update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change);
}
@@ -4487,9 +4487,9 @@ Sequence *BKE_sequencer_foreground_frame_get(Scene *scene, int frame)
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq, *best_seq = NULL;
int best_machine = -1;
-
+
if (!ed) return NULL;
-
+
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
continue;
@@ -4948,7 +4948,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
while (fcu) {
if (STREQLEN(fcu->rna_path, str, str_len)) {
FCurve *next_fcu = fcu->next;
-
+
BLI_remlink(&scene->adt->action->curves, fcu);
free_fcurve(fcu);
@@ -5202,7 +5202,7 @@ Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel);
seq->type = SEQ_TYPE_IMAGE;
seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */
-
+
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
@@ -5390,7 +5390,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq->anim_preseek = IMB_anim_get_preseek(anim_arr[0]);
BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2);
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
-
+
/* adjust scene's frame rate settings to match */
if (seq_load->flag & SEQ_LOAD_SYNC_FPS) {
IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true);
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index bf22b106cf8..e28b4ccc23d 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -163,7 +163,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
OUT_OF_MEMORY();
return;
}
-
+
/* Setup nearest */
nearest.index = -1;
nearest.dist_sq = FLT_MAX;
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index 6f5c264f658..0bf7a9f278e 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -374,65 +374,65 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
marked = MEM_callocN(nb_points, "marked array");
marked[start] = 1;
marked[end] = 1;
-
+
work = 1;
-
+
/* while still reducing */
while (work) {
int ls, le;
work = 0;
-
+
ls = start;
le = start + 1;
-
+
/* while not over interval */
while (ls < end) {
int max_i = 0;
short v1[2];
float max_dist = 16; /* more than 4 pixels */
-
+
/* find the next marked point */
while (marked[le] == 0) {
le++;
}
-
+
/* perpendicular vector to ls-le */
- v1[1] = old_points[le].p2d[0] - old_points[ls].p2d[0];
- v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1];
-
+ v1[1] = old_points[le].p2d[0] - old_points[ls].p2d[0];
+ v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1];
+
for (i = ls + 1; i < le; i++) {
float mul;
float dist;
short v2[2];
-
- v2[0] = old_points[i].p2d[0] - old_points[ls].p2d[0];
+
+ v2[0] = old_points[i].p2d[0] - old_points[ls].p2d[0];
v2[1] = old_points[i].p2d[1] - old_points[ls].p2d[1];
-
+
if (v2[0] == 0 && v2[1] == 0) {
continue;
}
mul = (float)(v1[0] * v2[0] + v1[1] * v2[1]) / (float)(v2[0] * v2[0] + v2[1] * v2[1]);
-
+
dist = mul * mul * (v2[0] * v2[0] + v2[1] * v2[1]);
-
+
if (dist > max_dist) {
max_dist = dist;
max_i = i;
}
}
-
+
if (max_i != 0) {
work = 1;
marked[max_i] = 1;
}
-
+
ls = le;
le = ls + 1;
}
}
-
+
/* adding points after range */
for (i = start; i <= end; i++) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 2ab892a0233..c1a085a3b15 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1810,7 +1810,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
int zn = z - new_shift[2];
int index;
float max_den;
-
+
/* skip if cell already belongs to new area */
if (xn >= min[0] && xn <= max[0] && yn >= min[1] && yn <= max[1] && zn >= min[2] && zn <= max[2])
continue;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index c3527af90ca..cf5ce374e4c 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2864,7 +2864,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
BodySpring *bs;
int a, totedge;
int defgroup_index, defgroup_index_mass, defgroup_index_spring;
-
+
if (ob->softflag & OB_SB_EDGES) totedge= me->totedge;
else totedge= 0;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 7ad8f03dfee..6aa44cde0e0 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -146,7 +146,7 @@ void BKE_sound_free(bSound *sound)
}
BKE_sound_free_waveform(sound);
-
+
#endif /* WITH_AUDASPACE */
if (sound->spinlock) {
BLI_spin_end(sound->spinlock);
@@ -775,7 +775,7 @@ void BKE_sound_read_waveform(bSound *sound, short *stop)
if (info.length > 0) {
int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND;
-
+
waveform->data = MEM_mallocN(length * sizeof(float) * 3, "SoundWaveform.samples");
waveform->length = AUD_readSound(sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, stop);
}
@@ -798,9 +798,9 @@ void BKE_sound_read_waveform(bSound *sound, short *stop)
BLI_spin_unlock(sound->spinlock);
return;
}
-
+
BKE_sound_free_waveform(sound);
-
+
BLI_spin_lock(sound->spinlock);
sound->waveform = waveform;
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 8e46cabff02..1f1270b85b6 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -202,7 +202,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
/* mask is allocated after regular layers */
ccgSubSurf_setAllocMask(ccgSS, 1, sizeof(float) * numLayers);
}
-
+
if (flags & CCG_CALC_NORMALS)
ccgSubSurf_setCalcVertexNormals(ccgSS, 1, normalOffset);
else
@@ -320,7 +320,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, limit, false, true);
if (!vmap)
return 0;
-
+
ccgSubSurf_initFullSync(ss);
/* create vertices */
@@ -618,12 +618,12 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
if (wtable->len <= faceLen) {
void *tmp = MEM_callocN(sizeof(FaceVertWeightEntry) * (faceLen + 1), "weight table alloc 2");
-
+
if (wtable->len) {
memcpy(tmp, wtable->weight_table, sizeof(FaceVertWeightEntry) * wtable->len);
MEM_freeN(wtable->weight_table);
}
-
+
wtable->weight_table = tmp;
wtable->len = faceLen + 1;
}
@@ -638,7 +638,7 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
for (y = 0; y < gridCuts + 2; y++) {
fx = 0.5f - (float)x / (float)(gridCuts + 1) / 2.0f;
fy = 0.5f - (float)y / (float)(gridCuts + 1) / 2.0f;
-
+
fac2 = faceLen - 4;
w1 = (1.0f - fx) * (1.0f - fy) + (-fac2 * fx * fy * fac);
w2 = (1.0f - fx + fac2 * fx * -fac) * (fy);
@@ -652,7 +652,7 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
w[j] = fac2;
}
}
-
+
w[i] = w1;
w[(i - 1 + faceLen) % faceLen] = w2;
w[(i + 1) % faceLen] = w4;
@@ -674,7 +674,7 @@ static void free_ss_weights(WeightTable *wtable)
if (wtable->weight_table[i].valid)
MEM_freeN(wtable->weight_table[i].w);
}
-
+
if (wtable->weight_table)
MEM_freeN(wtable->weight_table);
}
@@ -1105,7 +1105,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
/* numVerts = ccgSubSurf_getFaceNumVerts(f); */ /*UNUSED*/
gridSideEdges = gridSize - 1;
- gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2;
+ gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2;
offset = edgeNum - ccgdm->faceMap[i].startEdge;
grid = offset / (gridSideEdges + gridInternalEdges);
@@ -1219,7 +1219,7 @@ void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly,
int edgeSize = ccgSubSurf_getEdgeSize(ss);
int totface = ccgSubSurf_getNumFaces(ss);
int i, j, x, y;
-
+
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
@@ -1228,14 +1228,14 @@ void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly,
int hidden_gridsize = BKE_ccg_gridsize(md->level);
int factor = BKE_ccg_factor(level, md->level);
BLI_bitmap *hidden = md->hidden;
-
+
if (!hidden)
continue;
-
+
for (y = 0; y < gridSize; y++) {
for (x = 0; x < gridSize; x++) {
int vndx, offset;
-
+
vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize);
offset = (y * factor) * hidden_gridsize + (x * factor);
if (BLI_BITMAP_TEST(hidden, offset))
@@ -1259,11 +1259,11 @@ void subsurf_copy_grid_paint_mask(DerivedMesh *dm, const MPoly *mpoly,
int edgeSize = ccgSubSurf_getEdgeSize(ss);
int totface = ccgSubSurf_getNumFaces(ss);
int i, j, x, y, factor, gpm_gridsize;
-
+
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
const MPoly *p = &mpoly[i];
-
+
for (j = 0; j < p->totloop; j++) {
const GridPaintMask *gpm = &grid_paint_mask[p->loopstart + j];
if (!gpm->data)
@@ -1271,11 +1271,11 @@ void subsurf_copy_grid_paint_mask(DerivedMesh *dm, const MPoly *mpoly,
factor = BKE_ccg_factor(level, gpm->level);
gpm_gridsize = BKE_ccg_gridsize(gpm->level);
-
+
for (y = 0; y < gridSize; y++) {
for (x = 0; x < gridSize; x++) {
int vndx, offset;
-
+
vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize);
offset = y * factor * gpm_gridsize + x * factor;
paint_mask[vndx] = gpm->data[offset];
@@ -1314,7 +1314,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
vd = ccgSubSurf_getFaceCenterData(f);
ccgDM_to_MVert(&mvert[i++], &key, vd);
-
+
for (S = 0; S < numVerts; S++) {
for (x = 1; x < gridSize - 1; x++) {
vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
@@ -1631,7 +1631,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
CCGEdge **edgeMap2;
CCGVert **vertMap2;
int index, totvert, totedge, totface;
-
+
totvert = ccgSubSurf_getNumVerts(ss);
vertMap2 = MEM_mallocN(totvert * sizeof(*vertMap2), "vertmap");
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
@@ -1662,7 +1662,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
copy_v3_v3(cos[i++], ccgSubSurf_getFaceCenterData(f));
-
+
for (S = 0; S < numVerts; S++) {
for (x = 1; x < gridSize - 1; x++) {
copy_v3_v3(cos[i++], ccgSubSurf_getFaceGridEdgeData(ss, f, S, x));
@@ -1917,7 +1917,7 @@ static void ccgDM_NormalFast(float *a, float *b, float *c, float *d, float no[3]
no[0] = b_dY * a_cZ - b_dZ * a_cY;
no[1] = b_dZ * a_cX - b_dX * a_cZ;
no[2] = b_dX * a_cY - b_dY * a_cX;
-
+
normalize_v3(no);
}
@@ -1927,7 +1927,7 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
float no[3];
-
+
no[0] = b_dY * a_cZ - b_dZ * a_cY;
no[1] = b_dZ * a_cX - b_dX * a_cZ;
no[2] = b_dX * a_cY - b_dY * a_cX;
@@ -2022,7 +2022,7 @@ static void ccgDM_buffer_copy_normal(
ccgDM_NormalFast(a, b, c, d, f_no);
normal_float_to_short_v3(f_no_s, f_no);
-
+
copy_v3_v3_short(&varray[start], f_no_s);
copy_v3_v3_short(&varray[start + 4], f_no_s);
copy_v3_v3_short(&varray[start + 8], f_no_s);
@@ -2166,7 +2166,7 @@ static void ccgDM_buffer_copy_vertex(
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
-
+
for (S = 0; S < numVerts; S++) {
CCGElem *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
for (y = 0; y < gridFaces; y++) {
@@ -2598,7 +2598,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm)
BLI_assert(dm_totmat != 0);
matinfo = MEM_callocN(sizeof(*matinfo) * dm_totmat, "GPU_drawobject_new.mat_orig_to_new");
-
+
if (faceFlags) {
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
@@ -2621,7 +2621,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm)
tot_internal_edges += numVerts * gridFaces * (2 * gridFaces - 1);
}
}
-
+
/* create the GPUDrawObject */
gdo = MEM_callocN(sizeof(GPUDrawObject), "GPUDrawObject");
gdo->totvert = 0; /* used to count indices, doesn't really matter for ccgsubsurf */
@@ -3309,7 +3309,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int origIndex = ccgDM_getFaceMapIndex(ss, f);
int new_matnr;
-
+
numVerts = ccgSubSurf_getFaceNumVerts(f);
/* get flags */
@@ -3379,7 +3379,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
for (x = 0; x < gridFaces; x++) {
vda = CCG_grid_elem(&key, faceGridData, x, y);
vdb = CCG_grid_elem(&key, faceGridData, x, y + 1);
-
+
PASSATTRIB(0, 0, 0);
glNormal3fv(CCG_elem_no(&key, vda));
glVertex3fv(CCG_elem_co(&key, vda));
@@ -3427,7 +3427,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
glVertex3fv(bco);
PASSATTRIB(0, 0, 0);
glVertex3fv(aco);
-
+
a++;
}
}
@@ -3800,13 +3800,13 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
if (setMaterial) {
int mat_nr = faceFlags ? faceFlags[origIndex].mat_nr + 1 : 1;
-
+
if (mat_nr != prev_mat_nr) {
setMaterial(mat_nr, NULL); /* XXX, no faceFlags no material */
prev_mat_nr = mat_nr;
}
}
-
+
if (setDrawOptions && (index != ORIGINDEX_NONE))
draw_option = setDrawOptions(userData, index);
@@ -3853,7 +3853,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
for (x = 0; x < gridFaces; x++) {
a = CCG_grid_elem(&key, faceGridData, x, y + 0);
b = CCG_grid_elem(&key, faceGridData, x, y + 1);
-
+
if (cp) glColor4ubv(&cp[0]);
glNormal3fv(CCG_elem_no(&key, a));
glVertex3fv(CCG_elem_co(&key, a));
@@ -3891,7 +3891,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
float *d = CCG_grid_elem_co(&key, faceGridData, x, y + 1);
ccgDM_glNormalFast(a, b, c, d);
-
+
if (cp) glColor4ubv(&cp[4]);
glVertex3fv(d);
if (cp) glColor4ubv(&cp[8]);
@@ -4042,7 +4042,7 @@ static void ccgDM_release(DerivedMesh *dm)
{
ccgdm->multires.mmd = NULL;
}
-
+
if (ccgdm->multires.mmd) {
if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED)
multires_modifier_update_mdisps(dm);
@@ -4335,7 +4335,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
if (ccgdm->gridData)
return;
-
+
numGrids = ccgDM_getNumGrids(dm);
numFaces = ccgSubSurf_getNumFaces(ss);
/*gridSize = ccgDM_getGridSize(dm);*/ /*UNUSED*/
@@ -4401,7 +4401,7 @@ static void ccgDM_getGridKey(DerivedMesh *dm, CCGKey *key)
static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
-
+
ccgdm_create_grids(dm);
return ccgdm->gridFlagMats;
}
@@ -4409,7 +4409,7 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm)
static BLI_bitmap **ccgDM_getGridHidden(DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
-
+
ccgdm_create_grids(dm);
return ccgdm->gridHidden;
}
@@ -5204,7 +5204,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (levels == 0)
return dm;
-
+
ss = _getSubSurf(NULL, levels, 3, useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple, useSubsurfUv);
@@ -5297,9 +5297,9 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
void subsurf_calculate_limit_positions(Mesh *me, float (*r_positions)[3])
{
- /* Finds the subsurf limit positions for the verts in a mesh
- * and puts them in an array of floats. Please note that the
- * calculated vert positions is incorrect for the verts
+ /* Finds the subsurf limit positions for the verts in a mesh
+ * and puts them in an array of floats. Please note that the
+ * calculated vert positions is incorrect for the verts
* on the boundary of the mesh.
*/
CCGSubSurf *ss = _getSubSurf(NULL, 1, 3, CCG_USE_ARENA);
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index b74143b5c07..043fc813b95 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -164,7 +164,7 @@ void texttool_suggest_prefix(const char *prefix, const int prefix_len)
suggestions.lastmatch = suggestions.last;
return;
}
-
+
first = last = NULL;
for (match = suggestions.first; match; match = match->next) {
cmp = BLI_strncasecmp(prefix, match->name, prefix_len);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index eed3138ec1b..76df163ee3a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -232,15 +232,15 @@ void BKE_text_init(Text *ta)
tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line = (char *) MEM_mallocN(1, "textline_string");
tmp->format = NULL;
-
+
tmp->line[0] = 0;
tmp->len = 0;
-
+
tmp->next = NULL;
tmp->prev = NULL;
-
+
BLI_addhead(&ta->lines, tmp);
-
+
ta->curl = ta->lines.first;
ta->curc = 0;
ta->sell = ta->lines.first;
@@ -273,18 +273,18 @@ int txt_extended_ascii_as_utf8(char **str)
added++;
i += bad_char + 1;
}
-
+
if (added != 0) {
char *newstr = MEM_mallocN(length + added + 1, "text_line");
ptrdiff_t mi = 0;
i = 0;
-
+
while ((*str)[i]) {
if ((bad_char = BLI_utf8_invalid_byte((*str) + i, length - i)) == -1) {
memcpy(newstr + mi, (*str) + i, length - i + 1);
break;
}
-
+
memcpy(newstr + mi, (*str) + i, bad_char);
BLI_str_utf8_from_unicode((*str)[i + bad_char], newstr + mi + bad_char);
@@ -295,7 +295,7 @@ int txt_extended_ascii_as_utf8(char **str)
MEM_freeN(*str);
*str = newstr;
}
-
+
return added;
}
@@ -392,7 +392,7 @@ bool BKE_text_reload(Text *text)
BLI_strncpy(filepath_abs, text->name, FILE_MAX);
BLI_path_abs(filepath_abs, BKE_main_blendfile_path_from_global());
-
+
buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len);
if (buffer == NULL) {
return false;
@@ -427,7 +427,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
BLI_strncpy(filepath_abs, file, FILE_MAX);
if (relpath) /* can be NULL (bg mode) */
BLI_path_abs(filepath_abs, relpath);
-
+
buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len);
if (buffer == NULL) {
return false;
@@ -457,9 +457,9 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
else {
ta->mtime = 0;
}
-
+
text_from_buf(ta, buffer, buffer_len);
-
+
MEM_freeN(buffer);
return ta;
@@ -608,7 +608,7 @@ static void make_new_line(TextLine *line, char *newline)
{
if (line->line) MEM_freeN(line->line);
if (line->format) MEM_freeN(line->format);
-
+
line->line = newline;
line->len = strlen(newline);
line->format = NULL;
@@ -619,16 +619,16 @@ static TextLine *txt_new_line(const char *str)
TextLine *tmp;
if (!str) str = "";
-
+
tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line = MEM_mallocN(strlen(str) + 1, "textline_string");
tmp->format = NULL;
-
+
strcpy(tmp->line, str);
-
+
tmp->len = strlen(str);
tmp->next = tmp->prev = NULL;
-
+
return tmp;
}
@@ -639,29 +639,29 @@ static TextLine *txt_new_linen(const char *str, int n)
tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line = MEM_mallocN(n + 1, "textline_string");
tmp->format = NULL;
-
+
BLI_strncpy(tmp->line, (str) ? str : "", n + 1);
-
+
tmp->len = strlen(tmp->line);
tmp->next = tmp->prev = NULL;
-
+
return tmp;
}
void txt_clean_text(Text *text)
-{
+{
TextLine **top, **bot;
if (!text->lines.first) {
if (text->lines.last) text->lines.first = text->lines.last;
else text->lines.first = text->lines.last = txt_new_line(NULL);
}
-
+
if (!text->lines.last) text->lines.last = text->lines.first;
top = (TextLine **) &text->lines.first;
bot = (TextLine **) &text->lines.last;
-
+
while ((*top)->prev) *top = (*top)->prev;
while ((*bot)->next) *bot = (*bot)->next;
@@ -799,7 +799,7 @@ void txt_move_up(Text *text, const bool sel)
int column = txt_utf8_offset_to_column((*linep)->line, *charp);
*linep = (*linep)->prev;
*charp = txt_utf8_column_to_offset((*linep)->line, column);
-
+
}
else {
txt_move_bol(text, sel);
@@ -891,7 +891,7 @@ void txt_move_left(Text *text, const bool sel)
if (text->flags & TXT_TABSTOSPACES) {
tabsize = txt_calc_tab_left(*linep, *charp);
}
-
+
if (tabsize) {
(*charp) -= tabsize;
}
@@ -927,7 +927,7 @@ void txt_move_right(Text *text, const bool sel)
if (text->flags & TXT_TABSTOSPACES) {
tabsize = txt_calc_tab_right(*linep, *charp);
}
-
+
if (tabsize) {
(*charp) += tabsize;
}
@@ -935,7 +935,7 @@ void txt_move_right(Text *text, const bool sel)
(*charp) += BLI_str_utf8_size((*linep)->line + *charp);
}
}
-
+
if (!sel) txt_pop_sel(text);
}
@@ -951,7 +951,7 @@ void txt_jump_left(Text *text, const bool sel, const bool use_init_step)
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_PREV,
STRCUR_JUMP_DELIM, use_init_step);
-
+
if (!sel) txt_pop_sel(text);
}
@@ -963,11 +963,11 @@ void txt_jump_right(Text *text, const bool sel, const bool use_init_step)
if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
-
+
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_NEXT,
STRCUR_JUMP_DELIM, use_init_step);
-
+
if (!sel) txt_pop_sel(text);
}
@@ -979,7 +979,7 @@ void txt_move_bol(Text *text, const bool sel)
if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
-
+
*charp = 0;
if (!sel) txt_pop_sel(text);
@@ -1044,7 +1044,7 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel)
if (sel) txt_curs_sel(text, &linep, &charp);
else txt_curs_cur(text, &linep, &charp);
if (!*linep) return;
-
+
*linep = text->lines.first;
for (i = 0; i < line; i++) {
if ((*linep)->next) *linep = (*linep)->next;
@@ -1053,7 +1053,7 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel)
if (ch > (unsigned int)((*linep)->len))
ch = (unsigned int)((*linep)->len);
*charp = ch;
-
+
if (!sel) txt_pop_sel(text);
}
@@ -1065,7 +1065,7 @@ static void txt_curs_swap(Text *text)
{
TextLine *tmpl;
int tmpc;
-
+
tmpl = text->curl;
text->curl = text->sell;
text->sell = tmpl;
@@ -1082,7 +1082,7 @@ static void txt_pop_first(Text *text)
{
txt_curs_swap(text);
}
-
+
txt_pop_sel(text);
}
@@ -1093,7 +1093,7 @@ static void txt_pop_last(Text *text)
{
txt_curs_swap(text);
}
-
+
txt_pop_sel(text);
}
@@ -1107,7 +1107,7 @@ void txt_order_cursors(Text *text, const bool reverse)
{
if (!text->curl) return;
if (!text->sell) return;
-
+
/* Flip so text->curl is before/after text->sell */
if (reverse == false) {
if ((txt_get_span(text->curl, text->sell) < 0) ||
@@ -1139,7 +1139,7 @@ static void txt_delete_sel(Text *text, TextUndoBuf *utxt)
if (!text->sell) return;
if (!txt_has_sel(text)) return;
-
+
txt_order_cursors(text, false);
if (!undoing) {
@@ -1155,15 +1155,15 @@ static void txt_delete_sel(Text *text, TextUndoBuf *utxt)
buf[text->curc + (text->sell->len - text->selc)] = 0;
make_new_line(text->curl, buf);
-
+
tmpl = text->sell;
while (tmpl != text->curl) {
tmpl = tmpl->prev;
if (!tmpl) break;
-
+
txt_delete_line(text, tmpl->next);
}
-
+
text->sell = text->curl;
text->selc = text->curc;
}
@@ -1172,7 +1172,7 @@ void txt_sel_all(Text *text)
{
text->curl = text->lines.first;
text->curc = 0;
-
+
text->sell = text->lines.last;
text->selc = text->sell->len;
}
@@ -1193,7 +1193,7 @@ void txt_sel_clear(Text *text)
void txt_sel_line(Text *text)
{
if (!text->curl) return;
-
+
text->curc = 0;
text->sell = text->curl;
text->selc = text->sell->len;
@@ -1216,7 +1216,7 @@ char *txt_to_buf(Text *text)
linef = text->lines.first;
charf = 0;
-
+
linel = text->lines.last;
charl = linel->len;
@@ -1224,7 +1224,7 @@ char *txt_to_buf(Text *text)
length = charl - charf;
buf = MEM_mallocN(length + 2, "text buffer");
-
+
BLI_strncpy(buf, linef->line + charf, length + 1);
buf[length] = 0;
}
@@ -1232,37 +1232,37 @@ char *txt_to_buf(Text *text)
length = linef->len - charf;
length += charl;
length += 2; /* For the 2 '\n' */
-
+
tmp = linef->next;
while (tmp && tmp != linel) {
length += tmp->len + 1;
tmp = tmp->next;
}
-
+
buf = MEM_mallocN(length + 1, "cut buffer");
strncpy(buf, linef->line + charf, linef->len - charf);
length = linef->len - charf;
-
+
buf[length++] = '\n';
-
+
tmp = linef->next;
while (tmp && tmp != linel) {
strncpy(buf + length, tmp->line, tmp->len);
length += tmp->len;
-
+
buf[length++] = '\n';
-
+
tmp = tmp->next;
}
strncpy(buf + length, linel->line, charl);
length += charl;
-
+
/* python compiler wants an empty end line */
buf[length++] = '\n';
buf[length] = 0;
}
-
+
return buf;
}
@@ -1272,11 +1272,11 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
const char *s = NULL;
if (!text->curl || !text->sell) return 0;
-
+
txt_order_cursors(text, false);
tl = startl = text->sell;
-
+
if (match_case) s = strstr(&tl->line[text->selc], findstr);
else s = BLI_strcasestr(&tl->line[text->selc], findstr);
while (!s) {
@@ -1293,7 +1293,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
if (tl == startl)
break;
}
-
+
if (s) {
int newl = txt_get_span(text->lines.first, tl);
int newc = (int)(s - tl->line);
@@ -1314,10 +1314,10 @@ char *txt_sel_to_buf(Text *text)
if (!text->curl) return NULL;
if (!text->sell) return NULL;
-
+
if (text->curl == text->sell) {
linef = linel = text->curl;
-
+
if (text->curc < text->selc) {
charf = text->curc;
charl = text->selc;
@@ -1337,7 +1337,7 @@ char *txt_sel_to_buf(Text *text)
else {
linef = text->curl;
linel = text->sell;
-
+
charf = text->curc;
charl = text->selc;
}
@@ -1346,39 +1346,39 @@ char *txt_sel_to_buf(Text *text)
length = charl - charf;
buf = MEM_mallocN(length + 1, "sel buffer");
-
+
BLI_strncpy(buf, linef->line + charf, length + 1);
}
else {
length += linef->len - charf;
length += charl;
length++; /* For the '\n' */
-
+
tmp = linef->next;
while (tmp && tmp != linel) {
length += tmp->len + 1;
tmp = tmp->next;
}
-
+
buf = MEM_mallocN(length + 1, "sel buffer");
-
+
strncpy(buf, linef->line + charf, linef->len - charf);
length = linef->len - charf;
-
+
buf[length++] = '\n';
-
+
tmp = linef->next;
while (tmp && tmp != linel) {
strncpy(buf + length, tmp->line, tmp->len);
length += tmp->len;
-
+
buf[length++] = '\n';
-
+
tmp = tmp->next;
}
strncpy(buf + length, linel->line, charl);
length += charl;
-
+
buf[length] = 0;
}
@@ -1396,11 +1396,11 @@ void txt_insert_buf(Text *text, TextUndoBuf *utxt, const char *in_buffer)
if (!in_buffer) return;
txt_delete_sel(text, utxt);
-
+
len = strlen(in_buffer);
buffer = BLI_strdupn(in_buffer, len);
len += txt_extended_ascii_as_utf8(&buffer);
-
+
if (!undoing) {
txt_undo_add_blockop(text, utxt, UNDO_IBLOCK, buffer);
}
@@ -1410,7 +1410,7 @@ void txt_insert_buf(Text *text, TextUndoBuf *utxt, const char *in_buffer)
while (buffer[i] && buffer[i] != '\n') {
txt_add_raw_char(text, utxt, BLI_str_utf8_as_unicode_step(buffer, &i));
}
-
+
if (buffer[i] == '\n') {
txt_split_curline(text, utxt);
i++;
@@ -1495,16 +1495,16 @@ void txt_print_undo(Text *text)
int op;
const char *ops;
int linep, charp;
-
+
dump_buffer(text);
-
+
printf("---< Undo Buffer >---\n");
-
+
printf("UndoPosition is %d\n", utxt->pos);
-
+
while (i <= utxt->pos) {
op = utxt->buf[i];
-
+
if (op == UNDO_INSERT_1) {
ops = "Insert ascii ";
}
@@ -1562,7 +1562,7 @@ void txt_print_undo(Text *text)
else {
ops = "Unknown";
}
-
+
printf("Op (%o) at %d = %s", op, i, ops);
if (op >= UNDO_INSERT_1 && op <= UNDO_DEL_4) {
i++;
@@ -1603,14 +1603,14 @@ void txt_print_undo(Text *text)
linep = linep + (utxt->buf[i] << 8); i++;
linep = linep + (utxt->buf[i] << 16); i++;
linep = linep + (utxt->buf[i] << 24); i++;
-
+
printf(" (length %d) <", linep);
-
+
while (linep > 0) {
putchar(utxt->buf[i]);
linep--; i++;
}
-
+
linep = utxt->buf[i]; i++;
linep = linep + (utxt->buf[i] << 8); i++;
linep = linep + (utxt->buf[i] << 16); i++;
@@ -1627,7 +1627,7 @@ void txt_print_undo(Text *text)
linep = linep + (utxt->buf[i] << 8); i++;
linep = linep + (utxt->buf[i] << 16); i++;
linep = linep + (utxt->buf[i] << 24); i++;
-
+
printf("to <%d, %d> ", linep, charp);
charp = utxt->buf[i]; i++;
@@ -1637,17 +1637,17 @@ void txt_print_undo(Text *text)
linep = linep + (utxt->buf[i] << 8); i++;
linep = linep + (utxt->buf[i] << 16); i++;
linep = linep + (utxt->buf[i] << 24); i++;
-
+
printf("from <%d, %d>", linep, charp);
}
-
+
printf(" %d\n", i);
i++;
}
}
#endif
-static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value)
+static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value)
{
undo_buf[*undo_pos] = (value) & 0xff;
(*undo_pos)++;
@@ -1655,7 +1655,7 @@ static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short
(*undo_pos)++;
}
-static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int value)
+static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int value)
{
undo_buf[*undo_pos] = (value) & 0xff;
(*undo_pos)++;
@@ -1739,7 +1739,7 @@ static void txt_undo_add_charop(Text *text, TextUndoBuf *utxt, int op_start, uns
{
char utf8[BLI_UTF8_MAX];
size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8);
-
+
if (utf8_size < 4 && 0) {
if (!max_undo_test(utxt, 2 + 6 + utf8_size + 1)) {
return;
@@ -1773,7 +1773,7 @@ static void txt_undo_add_charop(Text *text, TextUndoBuf *utxt, int op_start, uns
/* 1 byte */
utxt->buf[utxt->pos] = op_start + 3;
}
-
+
txt_undo_end(text, utxt);
}
@@ -1872,10 +1872,10 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s
{
unsigned int unicode;
char utf8[BLI_UTF8_MAX + 1];
-
+
switch (bytes) {
case 1: /* ascii */
- unicode = undo_buf[*undo_pos]; (*undo_pos)--;
+ unicode = undo_buf[*undo_pos]; (*undo_pos)--;
break;
case 2: /* 2-byte symbol */
utf8[2] = '\0';
@@ -1899,7 +1899,7 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s
unicode = 0;
break;
}
-
+
return unicode;
}
@@ -1948,10 +1948,10 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s
{
unsigned int unicode;
char utf8[BLI_UTF8_MAX + 1];
-
+
switch (bytes) {
case 1: /* ascii */
- unicode = undo_buf[*undo_pos]; (*undo_pos)++;
+ unicode = undo_buf[*undo_pos]; (*undo_pos)++;
break;
case 2: /* 2-byte symbol */
utf8[0] = undo_buf[*undo_pos]; (*undo_pos)++;
@@ -1975,7 +1975,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s
unicode = 0;
break;
}
-
+
return unicode;
}
@@ -1989,7 +1989,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
unsigned short curc, selc;
unsigned short charp;
char *buf;
-
+
if (utxt->pos < 0) {
return;
}
@@ -1997,21 +1997,21 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
utxt->pos--;
undoing = 1;
-
+
switch (op) {
case UNDO_INSERT_1:
case UNDO_INSERT_2:
case UNDO_INSERT_3:
case UNDO_INSERT_4:
utxt->pos -= op - UNDO_INSERT_1 + 1;
-
+
/* get and restore the cursors */
txt_undo_read_cur(utxt->buf, &utxt->pos, &curln, &curc);
txt_move_to(text, curln, curc, 0);
txt_move_to(text, curln, curc, 1);
-
+
txt_delete_char(text, utxt);
-
+
utxt->pos--;
break;
@@ -2021,12 +2021,12 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
case UNDO_BS_4:
charp = op - UNDO_BS_1 + 1;
uni_char = txt_undo_read_unicode(utxt->buf, &utxt->pos, charp);
-
+
/* get and restore the cursors */
txt_undo_read_cur(utxt->buf, &utxt->pos, &curln, &curc);
txt_move_to(text, curln, curc, 0);
txt_move_to(text, curln, curc, 1);
-
+
txt_add_char(text, utxt, uni_char);
utxt->pos--;
@@ -2072,7 +2072,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
/* move cur to location that needs buff inserted */
txt_move_to(text, curln, curc, 0);
-
+
txt_insert_buf(text, utxt, buf);
MEM_freeN(buf);
@@ -2081,7 +2081,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
txt_move_to(text, selln, selc, 1);
utxt->pos--;
-
+
break;
}
case UNDO_IBLOCK:
@@ -2089,7 +2089,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
int i;
/* length of the string in the buffer */
linep = txt_undo_read_uint32(utxt->buf, &utxt->pos);
-
+
/* txt_backspace_char removes utf8-characters, not bytes */
buf = MEM_mallocN(linep + 1, "iblock buffer");
for (i = 0; i < linep; i++) {
@@ -2099,29 +2099,29 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
buf[i] = 0;
linep = BLI_strlen_utf8(buf);
MEM_freeN(buf);
-
+
/* skip over the length that was stored again */
utxt->pos -= 4;
/* get and restore the cursors */
txt_undo_read_cursors(utxt->buf, &utxt->pos, &curln, &curc, &selln, &selc);
-
+
txt_move_to(text, curln, curc, 0);
txt_move_to(text, selln, selc, 1);
-
+
if ((curln == selln) && (curc == selc)) {
/* disable tabs to spaces since moving right may involve skipping multiple spaces */
prev_flags = text->flags;
text->flags &= ~TXT_TABSTOSPACES;
-
+
for (i = 0; i < linep; i++)
txt_move_right(text, 1);
-
+
text->flags = prev_flags;
}
-
+
txt_delete_selected(text, utxt);
-
+
utxt->pos--;
break;
}
@@ -2134,7 +2134,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
txt_undo_read_cursors(utxt->buf, &utxt->pos, &curln, &curc, &selln, &selc);
txt_move_to(text, curln, curc, 0);
txt_move_to(text, selln, selc, 1);
-
+
if (op == UNDO_INDENT) {
txt_unindent(text, utxt);
}
@@ -2150,7 +2150,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
else if (op == UNDO_MOVE_LINES_DOWN) {
txt_move_lines(text, utxt, TXT_MOVE_LINE_UP);
}
-
+
utxt->pos--;
break;
case UNDO_UNINDENT:
@@ -2199,10 +2199,10 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt)
default:
//XXX error("Undo buffer error - resetting");
utxt->pos = -1;
-
+
break;
}
-
+
undoing = 0;
}
@@ -2215,15 +2215,15 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
unsigned int uni_uchar;
unsigned int curln, selln;
unsigned short curc, selc;
-
+
utxt->pos++;
op = utxt->buf[utxt->pos];
-
+
if (!op) {
utxt->pos--;
return;
}
-
+
undoing = 1;
switch (op) {
@@ -2232,12 +2232,12 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
case UNDO_INSERT_3:
case UNDO_INSERT_4:
utxt->pos++;
-
+
/* get and restore the cursors */
txt_redo_read_cur(utxt->buf, &utxt->pos, &curln, &curc);
txt_move_to(text, curln, curc, 0);
txt_move_to(text, curln, curc, 1);
-
+
charp = op - UNDO_INSERT_1 + 1;
uni_uchar = txt_redo_read_unicode(utxt->buf, &utxt->pos, charp);
@@ -2256,7 +2256,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
txt_move_to(text, curln, curc, 1);
utxt->pos += op - UNDO_BS_1 + 1;
-
+
/* move right so we backspace the correct char */
txt_move_right(text, 0);
txt_backspace_char(text, utxt);
@@ -2273,7 +2273,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
txt_redo_read_cur(utxt->buf, &utxt->pos, &curln, &curc);
txt_move_to(text, curln, curc, 0);
txt_move_to(text, curln, curc, 1);
-
+
utxt->pos += op - UNDO_DEL_1 + 1;
txt_delete_char(text, utxt);
@@ -2290,12 +2290,12 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
/* length of the block */
linep = txt_redo_read_uint32(utxt->buf, &utxt->pos);
-
+
utxt->pos += linep;
/* skip over the length that was stored again */
utxt->pos += 4;
-
+
txt_delete_sel(text, utxt);
break;
@@ -2315,7 +2315,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
memcpy(buf, &utxt->buf[utxt->pos], linep);
utxt->pos += linep;
buf[linep] = 0;
-
+
txt_insert_buf(text, utxt, buf);
MEM_freeN(buf);
@@ -2323,7 +2323,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
utxt->pos += 4;
break;
-
+
case UNDO_INDENT:
case UNDO_COMMENT:
case UNDO_UNCOMMENT:
@@ -2392,15 +2392,15 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt)
default:
//XXX error("Undo buffer error - resetting");
utxt->pos = -1;
-
+
break;
}
-
+
undoing = 0;
}
/**************************/
-/* Line editing functions */
+/* Line editing functions */
/**************************/
void txt_split_curline(Text *text, TextUndoBuf *utxt)
@@ -2413,13 +2413,13 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt)
txt_delete_sel(text, utxt);
if (!undoing) txt_undo_add_charop(text, utxt, UNDO_INSERT_1, '\n');
-
+
/* Make the two half strings */
left = MEM_mallocN(text->curc + 1, "textline_string");
if (text->curc) memcpy(left, text->curl->line, text->curc);
left[text->curc] = 0;
-
+
right = MEM_mallocN(text->curl->len - text->curc + 1, "textline_string");
memcpy(right, text->curl->line + text->curc, text->curl->len - text->curc + 1);
@@ -2427,7 +2427,7 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt)
if (text->curl->format) MEM_freeN(text->curl->format);
/* Make the new TextLine */
-
+
ins = MEM_mallocN(sizeof(TextLine), "textline");
ins->line = left;
ins->format = NULL;
@@ -2436,14 +2436,14 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt)
text->curl->line = right;
text->curl->format = NULL;
text->curl->len = text->curl->len - text->curc;
-
+
BLI_insertlinkbefore(&text->lines, text->curl, ins);
-
+
text->curc = 0;
-
+
txt_make_dirty(text);
txt_clean_text(text);
-
+
txt_pop_sel(text);
}
@@ -2452,7 +2452,7 @@ static void txt_delete_line(Text *text, TextLine *line)
if (!text->curl) return;
BLI_remlink(&text->lines, line);
-
+
if (line->line) MEM_freeN(line->line);
if (line->format) MEM_freeN(line->format);
@@ -2465,21 +2465,21 @@ static void txt_delete_line(Text *text, TextLine *line)
static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
{
char *tmp, *s;
-
+
if (!linea || !lineb) return;
tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string");
-
+
s = tmp;
s += BLI_strcpy_rlen(s, linea->line);
s += BLI_strcpy_rlen(s, lineb->line);
(void)s;
make_new_line(linea, tmp);
-
+
txt_delete_line(text, lineb);
-
+
txt_make_dirty(text);
txt_clean_text(text);
}
@@ -2487,16 +2487,16 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
void txt_duplicate_line(Text *text, TextUndoBuf *utxt)
{
TextLine *textline;
-
+
if (!text->curl) return;
-
+
if (text->curl == text->sell) {
textline = txt_new_line(text->curl->line);
BLI_insertlinkafter(&text->lines, text->curl, textline);
-
+
txt_make_dirty(text);
txt_clean_text(text);
-
+
if (!undoing) txt_undo_add_op(text, utxt, UNDO_DUPLICATE);
}
}
@@ -2523,7 +2523,7 @@ void txt_delete_char(Text *text, TextUndoBuf *utxt)
else { /* Just deleting a char */
size_t c_len = 0;
c = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len);
-
+
memmove(text->curl->line + text->curc, text->curl->line + text->curc + c_len, text->curl->len - text->curc - c_len + 1);
text->curl->len -= c_len;
@@ -2533,7 +2533,7 @@ void txt_delete_char(Text *text, TextUndoBuf *utxt)
txt_make_dirty(text);
txt_clean_text(text);
-
+
if (!undoing) txt_undo_add_charop(text, utxt, UNDO_DEL_1, c);
}
@@ -2547,9 +2547,9 @@ void txt_delete_word(Text *text, TextUndoBuf *utxt)
void txt_backspace_char(Text *text, TextUndoBuf *utxt)
{
unsigned int c = '\n';
-
+
if (!text->curl) return;
-
+
if (txt_has_sel(text)) { /* deleting a selection */
txt_delete_sel(text, utxt);
txt_make_dirty(text);
@@ -2557,10 +2557,10 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt)
}
else if (text->curc == 0) { /* Appending two lines */
if (!text->curl->prev) return;
-
+
text->curl = text->curl->prev;
text->curc = text->curl->len;
-
+
txt_combine_lines(text, text->curl, text->curl->next);
txt_pop_sel(text);
}
@@ -2568,7 +2568,7 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt)
size_t c_len = 0;
const char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
c = BLI_str_utf8_as_unicode_and_size(prev, &c_len);
-
+
/* source and destination overlap, don't use memcpy() */
memmove(text->curl->line + text->curc - c_len,
text->curl->line + text->curc,
@@ -2582,7 +2582,7 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt)
txt_make_dirty(text);
txt_clean_text(text);
-
+
if (!undoing) txt_undo_add_charop(text, utxt, UNDO_BS_1, c);
}
@@ -2619,7 +2619,7 @@ static bool txt_add_char_intern(Text *text, TextUndoBuf *utxt, unsigned int add,
txt_split_curline(text, utxt);
return true;
}
-
+
/* insert spaces rather than tabs */
if (add == '\t' && replace_tabs) {
txt_convert_tab_to_spaces(text, utxt);
@@ -2627,23 +2627,23 @@ static bool txt_add_char_intern(Text *text, TextUndoBuf *utxt, unsigned int add,
}
txt_delete_sel(text, utxt);
-
+
if (!undoing) txt_undo_add_charop(text, utxt, UNDO_INSERT_1, add);
add_len = BLI_str_utf8_from_unicode(add, ch);
-
+
tmp = MEM_mallocN(text->curl->len + add_len + 1, "textline_string");
-
+
memcpy(tmp, text->curl->line, text->curc);
memcpy(tmp + text->curc, ch, add_len);
memcpy(tmp + text->curc + add_len, text->curl->line + text->curc, text->curl->len - text->curc + 1);
make_new_line(text->curl, tmp);
-
+
text->curc += add_len;
txt_pop_sel(text);
-
+
txt_make_dirty(text);
txt_clean_text(text);
@@ -2678,10 +2678,10 @@ bool txt_replace_char(Text *text, TextUndoBuf *utxt, unsigned int add)
if (text->curc == text->curl->len || txt_has_sel(text) || add == '\n') {
return txt_add_char(text, utxt, add);
}
-
+
del = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &del_size);
add_size = BLI_str_utf8_from_unicode(add, ch);
-
+
if (add_size > del_size) {
char *tmp = MEM_mallocN(text->curl->len + add_size - del_size + 1, "textline_string");
memcpy(tmp, text->curl->line, text->curc);
@@ -2693,11 +2693,11 @@ bool txt_replace_char(Text *text, TextUndoBuf *utxt, unsigned int add)
char *tmp = text->curl->line;
memmove(tmp + text->curc + add_size, tmp + text->curc + del_size, text->curl->len - text->curc - del_size + 1);
}
-
+
memcpy(text->curl->line + text->curc, ch, add_size);
text->curc += add_size;
text->curl->len += add_size - del_size;
-
+
txt_pop_sel(text);
txt_make_dirty(text);
txt_clean_text(text);
@@ -2752,7 +2752,7 @@ static void txt_select_prefix(Text *text, const char *add)
txt_make_dirty(text);
txt_clean_text(text);
}
-
+
if (text->curl == text->sell) {
text->selc += indentlen;
break;
@@ -2769,7 +2769,7 @@ static void txt_select_prefix(Text *text, const char *add)
text->curl = text->curl->prev;
num--;
}
-
+
/* caller must handle undo */
}
@@ -2819,10 +2819,10 @@ static void txt_select_unprefix(
(*r_line_index_mask_len) += 1;
}
}
-
+
txt_make_dirty(text);
txt_clean_text(text);
-
+
if (text->curl == text->sell) {
if (changed)
text->selc = MAX2(text->selc - indentlen, 0);
@@ -2833,7 +2833,7 @@ static void txt_select_unprefix(
num++;
}
-
+
}
if (unindented_first)
@@ -2901,7 +2901,7 @@ void txt_unindent(Text *text, TextUndoBuf *utxt)
const char *prefix = (text->flags & TXT_TABSTOSPACES) ? tab_to_spaces : "\t";
ListBase line_index_mask;
int line_index_mask_len;
-
+
if (ELEM(NULL, text->curl, text->sell)) {
return;
}
@@ -2922,13 +2922,13 @@ void txt_move_lines(struct Text *text, TextUndoBuf *utxt, const int direction)
BLI_assert(ELEM(direction, TXT_MOVE_LINE_UP, TXT_MOVE_LINE_DOWN));
if (!text->curl || !text->sell) return;
-
+
txt_order_cursors(text, false);
line_other = (direction == TXT_MOVE_LINE_DOWN) ? text->sell->next : text->curl->prev;
-
+
if (!line_other) return;
-
+
BLI_remlink(&text->lines, line_other);
if (direction == TXT_MOVE_LINE_DOWN) {
@@ -2940,7 +2940,7 @@ void txt_move_lines(struct Text *text, TextUndoBuf *utxt, const int direction)
txt_make_dirty(text);
txt_clean_text(text);
-
+
if (!undoing) {
txt_undo_add_op(text, utxt, (direction == TXT_MOVE_LINE_DOWN) ? UNDO_MOVE_LINES_DOWN : UNDO_MOVE_LINES_UP);
}
@@ -2970,7 +2970,7 @@ int txt_setcurr_tab_spaces(Text *text, int space)
/* if we find a ':' on this line, then add a tab but not if it is:
* 1) in a comment
* 2) within an identifier
- * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
+ * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
int a;
bool is_indent = false;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 250408642bb..a0399c74be1 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -78,9 +78,9 @@
TexMapping *BKE_texture_mapping_add(int type)
{
TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping");
-
+
BKE_texture_mapping_default(texmap, type);
-
+
return texmap;
}
@@ -134,7 +134,7 @@ void BKE_texture_mapping_init(TexMapping *texmap)
if (fabsf(size[2]) < 1e-5f)
size[2] = signf(size[2]) * 1e-5f;
}
-
+
size_to_mat4(smat, texmap->size);
/* rotation */
@@ -175,9 +175,9 @@ void BKE_texture_mapping_init(TexMapping *texmap)
ColorMapping *BKE_texture_colormapping_add(void)
{
ColorMapping *colormap = MEM_callocN(sizeof(ColorMapping), "ColorMapping");
-
+
BKE_texture_colormapping_default(colormap);
-
+
return colormap;
}
@@ -229,7 +229,7 @@ void BKE_texture_free(Tex *tex)
BKE_texture_ocean_free(tex->ot);
tex->ot = NULL;
}
-
+
BKE_icon_id_delete((ID *)tex);
BKE_previewimg_free(&tex->preview);
}
@@ -297,30 +297,30 @@ void BKE_texture_default(Tex *tex)
tex->pd->radius = 0.3f;
tex->pd->falloff_type = TEX_PD_FALLOFF_STD;
}
-
+
if (tex->vd) {
tex->vd->resol[0] = tex->vd->resol[1] = tex->vd->resol[2] = 0;
tex->vd->interp_type = TEX_VD_LINEAR;
tex->vd->file_format = TEX_VD_SMOKE;
}
-
+
if (tex->ot) {
tex->ot->output = TEX_OCN_DISPLACEMENT;
tex->ot->object = NULL;
}
-
+
tex->iuser.fie_ima = 2;
tex->iuser.ok = 1;
tex->iuser.frames = 100;
tex->iuser.sfra = 1;
-
+
tex->preview = NULL;
}
void BKE_texture_type_set(Tex *tex, int type)
{
switch (type) {
-
+
case TEX_VOXELDATA:
if (tex->vd == NULL)
tex->vd = BKE_texture_voxeldata_add();
@@ -338,7 +338,7 @@ void BKE_texture_type_set(Tex *tex, int type)
tex->ot = BKE_texture_ocean_add();
break;
}
-
+
tex->type = type;
}
@@ -349,9 +349,9 @@ Tex *BKE_texture_add(Main *bmain, const char *name)
Tex *tex;
tex = BKE_libblock_alloc(bmain, ID_TE, name, 0);
-
+
BKE_texture_default(tex);
-
+
return tex;
}
@@ -431,11 +431,11 @@ void BKE_texture_mtex_default(MTex *mtex)
MTex *BKE_texture_mtex_add(void)
{
MTex *mtex;
-
+
mtex = MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add");
-
+
BKE_texture_mtex_default(mtex);
-
+
return mtex;
}
@@ -450,7 +450,7 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot)
if (mtex_ar == NULL) {
return NULL;
}
-
+
if (slot == -1) {
/* find first free */
int i;
@@ -556,11 +556,11 @@ Tex *BKE_texture_localize(Tex *tex)
* ... Once f*** nodes are fully converted to that too :( */
Tex *texn;
-
+
texn = BKE_libblock_copy_nolib(&tex->id, false);
-
+
/* image texture: BKE_texture_free also doesn't decrease */
-
+
if (texn->coba) texn->coba = MEM_dupallocN(texn->coba);
if (texn->env) {
texn->env = BKE_texture_envmap_copy(texn->env, LIB_ID_CREATE_NO_USER_REFCOUNT);
@@ -575,13 +575,13 @@ Tex *BKE_texture_localize(Tex *tex)
if (texn->ot) {
texn->ot = BKE_texture_ocean_copy(tex->ot, LIB_ID_CREATE_NO_USER_REFCOUNT);
}
-
+
texn->preview = NULL;
-
+
if (tex->nodetree) {
texn->nodetree = ntreeLocalize(tex->nodetree);
}
-
+
return texn;
}
@@ -597,10 +597,10 @@ Tex *give_current_object_texture(Object *ob)
{
Material *ma, *node_ma;
Tex *tex = NULL;
-
+
if (ob == NULL) return NULL;
if (ob->totcol == 0 && !(ob->type == OB_LAMP)) return NULL;
-
+
if (ob->type == OB_LAMP) {
tex = give_current_lamp_texture(ob->data);
}
@@ -612,7 +612,7 @@ Tex *give_current_object_texture(Object *ob)
tex = give_current_material_texture(ma);
}
-
+
return tex;
}
@@ -641,7 +641,7 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
la->mtex[act] = BKE_texture_mtex_add();
la->mtex[act]->texco = TEXCO_GLOB;
}
-
+
la->mtex[act]->tex = newtex;
id_us_plus(&newtex->id);
}
@@ -690,7 +690,7 @@ bNode *give_current_material_texture_node(Material *ma)
{
if (ma && ma->use_nodes && ma->nodetree)
return nodeGetActiveID(ma->nodetree, ID_TE);
-
+
return NULL;
}
@@ -699,7 +699,7 @@ Tex *give_current_material_texture(Material *ma)
MTex *mtex = NULL;
Tex *tex = NULL;
bNode *node;
-
+
if (ma && ma->use_nodes && ma->nodetree) {
/* first check texture, then material, this works together
* with a hack that clears the active ID flag for textures on
@@ -716,7 +716,7 @@ Tex *give_current_material_texture(Material *ma)
mtex = ma->mtex[(int)(ma->texact)];
if (mtex) tex = mtex->tex;
}
-
+
return tex;
}
@@ -812,7 +812,7 @@ void set_current_material_texture(Material *ma, Tex *newtex)
ma->mtex[act]->texco = TEXCO_ORCO;
}
}
-
+
ma->mtex[act]->tex = newtex;
id_us_plus(&newtex->id);
}
@@ -841,12 +841,12 @@ Tex *give_current_world_texture(World *world)
{
MTex *mtex = NULL;
Tex *tex = NULL;
-
+
if (!world) return NULL;
-
+
mtex = world->mtex[(int)(world->texact)];
if (mtex) tex = mtex->tex;
-
+
return tex;
}
@@ -862,7 +862,7 @@ void set_current_world_texture(World *wo, Tex *newtex)
wo->mtex[act] = BKE_texture_mtex_add();
wo->mtex[act]->texco = TEXCO_VIEW;
}
-
+
wo->mtex[act]->tex = newtex;
id_us_plus(&newtex->id);
}
@@ -892,12 +892,12 @@ Tex *give_current_particle_texture(ParticleSettings *part)
{
MTex *mtex = NULL;
Tex *tex = NULL;
-
+
if (!part) return NULL;
-
+
mtex = part->mtex[(int)(part->texact)];
if (mtex) tex = mtex->tex;
-
+
return tex;
}
@@ -914,7 +914,7 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
part->mtex[act]->texco = TEXCO_ORCO;
part->mtex[act]->blendtype = MTEX_MUL;
}
-
+
part->mtex[act]->tex = newtex;
id_us_plus(&newtex->id);
}
@@ -929,7 +929,7 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
EnvMap *BKE_texture_envmap_add(void)
{
EnvMap *env;
-
+
env = MEM_callocN(sizeof(EnvMap), "envmap");
env->type = ENV_CUBE;
env->stype = ENV_ANIM;
@@ -937,9 +937,9 @@ EnvMap *BKE_texture_envmap_add(void)
env->clipend = 100.0;
env->cuberes = 512;
env->viewscale = 0.5;
-
+
return env;
-}
+}
/* ------------------------------------------------------------------------- */
@@ -947,7 +947,7 @@ EnvMap *BKE_texture_envmap_copy(const EnvMap *env, const int flag)
{
EnvMap *envn;
int a;
-
+
envn = MEM_dupallocN(env);
envn->ok = 0;
for (a = 0; a < 6; a++) {
@@ -965,7 +965,7 @@ EnvMap *BKE_texture_envmap_copy(const EnvMap *env, const int flag)
void BKE_texture_envmap_free_data(EnvMap *env)
{
unsigned int part;
-
+
for (part = 0; part < 6; part++) {
if (env->cube[part])
IMB_freeImBuf(env->cube[part]);
@@ -978,10 +978,10 @@ void BKE_texture_envmap_free_data(EnvMap *env)
void BKE_texture_envmap_free(EnvMap *env)
{
-
+
BKE_texture_envmap_free_data(env);
MEM_freeN(env);
-
+
}
/* ------------------------------------------------------------------------- */
@@ -1018,7 +1018,7 @@ PointDensity *BKE_texture_pointdensity_add(void)
PointDensity *pd = MEM_callocN(sizeof(PointDensity), "pointdensity");
BKE_texture_pointdensity_init_data(pd);
return pd;
-}
+}
PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag))
{
@@ -1068,13 +1068,13 @@ void BKE_texture_voxeldata_free_data(VoxelData *vd)
}
}
-
+
void BKE_texture_voxeldata_free(VoxelData *vd)
{
BKE_texture_voxeldata_free_data(vd);
MEM_freeN(vd);
}
-
+
VoxelData *BKE_texture_voxeldata_add(void)
{
VoxelData *vd;
@@ -1089,10 +1089,10 @@ VoxelData *BKE_texture_voxeldata_add(void)
vd->object = NULL;
vd->cachedframe = -1;
vd->ok = 0;
-
+
return vd;
}
-
+
VoxelData *BKE_texture_voxeldata_copy(VoxelData *vd)
{
VoxelData *vdn;
@@ -1108,18 +1108,18 @@ VoxelData *BKE_texture_voxeldata_copy(VoxelData *vd)
OceanTex *BKE_texture_ocean_add(void)
{
OceanTex *ot;
-
+
ot = MEM_callocN(sizeof(struct OceanTex), "ocean texture");
ot->output = TEX_OCN_DISPLACEMENT;
ot->object = NULL;
-
+
return ot;
}
OceanTex *BKE_texture_ocean_copy(const OceanTex *ot, const int UNUSED(flag))
{
OceanTex *otn = MEM_dupallocN(ot);
-
+
return otn;
}
diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c
index c21883c6eb8..a5d35449229 100644
--- a/source/blender/blenkernel/intern/tracking_solver.c
+++ b/source/blender/blenkernel/intern/tracking_solver.c
@@ -518,7 +518,7 @@ bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieT
BKE_tracking_dopesheet_tag_update(tracking);
object = BKE_tracking_object_get_named(tracking, context->object_name);
-
+
if (context->is_camera)
reconstruction = &tracking->reconstruction;
else
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 5736c9331bf..545ca41c9c0 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -72,7 +72,7 @@ void BKE_world_free(World *wrld)
}
GPU_material_free(&wrld->gpumaterial);
-
+
BKE_icon_id_delete((struct ID *)wrld);
BKE_previewimg_free(&wrld->preview);
}
@@ -101,7 +101,7 @@ void BKE_world_init(World *wrld)
wrld->aobias = 0.05f;
wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
wrld->ao_approx_error = 0.25f;
-
+
wrld->preview = NULL;
wrld->miststa = 5.0f;
wrld->mistdist = 25.0f;
@@ -168,9 +168,9 @@ World *BKE_world_localize(World *wrld)
World *wrldn;
int a;
-
+
wrldn = BKE_libblock_copy_nolib(&wrld->id, false);
-
+
for (a = 0; a < MAX_MTEX; a++) {
if (wrld->mtex[a]) {
wrldn->mtex[a] = MEM_mallocN(sizeof(MTex), __func__);
@@ -180,11 +180,11 @@ World *BKE_world_localize(World *wrld)
if (wrld->nodetree)
wrldn->nodetree = ntreeLocalize(wrld->nodetree);
-
+
wrldn->preview = NULL;
-
+
BLI_listbase_clear(&wrldn->gpumaterial);
-
+
return wrldn;
}
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 17171dc1d2d..7e989b6588f 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -203,7 +203,7 @@ static int start_avi(void *context_v, Scene *UNUSED(scene), RenderData *rd, int
BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file");
return 0;
}
-
+
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x);
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_HEIGHT, &y);
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_QUALITY, &quality);
@@ -213,7 +213,7 @@ static int start_avi(void *context_v, Scene *UNUSED(scene), RenderData *rd, int
avi->odd_fields = 0;
/* avi->interlace = rd->mode & R_FIELDS; */
/* avi->odd_fields = (rd->mode & R_ODDFIELD) ? 1 : 0; */
-
+
printf("Created avi: %s\n", name);
return 1;
}
@@ -225,7 +225,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame,
int x, y;
char *cp, rt;
AviMovie *avi = context_v;
-
+
if (avi == NULL)
return 0;
@@ -236,7 +236,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame,
/* flip y and convert to abgr */
for (y = 0; y < recty; y++, rt1 += rectx, rt2 -= rectx) {
memcpy(rt1, rt2, rectx * sizeof(int));
-
+
cp = (char *)rt1;
for (x = rectx; x > 0; x--) {
rt = cp[0];
@@ -248,7 +248,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame,
cp += 4;
}
}
-
+
AVI_write_frame(avi, (frame - start_frame), AVI_FORMAT_RGB32, rectot, rectx * recty * 4);
// printf("added frame %3d (frame %3d in avi): ", frame, frame-start_frame);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index bf702aa95b9..2bee16a30c8 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -231,7 +231,7 @@ static AVFrame *alloc_picture(int pix_fmt, int width, int height)
AVFrame *f;
uint8_t *buf;
int size;
-
+
/* allocate space for the struct */
f = av_frame_alloc();
if (!f) return NULL;
@@ -515,7 +515,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
if (!rd->ffcodecdata.properties) {
return;
}
-
+
prop = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, prop_name);
if (!prop) {
return;
@@ -544,13 +544,13 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
st->id = 0;
/* Set up the codec context */
-
+
c = st->codec;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
/* Get some values from the current render settings */
-
+
c->width = rectx;
c->height = recty;
@@ -567,7 +567,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
c->time_base.den = rd->frs_sec * 100000;
c->time_base.num = ((double) rd->frs_sec_base) * 100000;
}
-
+
c->gop_size = context->ffmpeg_gop_size;
c->max_b_frames = context->ffmpeg_max_b_frames;
@@ -621,11 +621,11 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
/* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */
//c->me_method = ME_EPZS;
-
+
codec = avcodec_find_encoder(c->codec_id);
if (!codec)
return NULL;
-
+
/* Be sure to use the correct pixel format(e.g. RGB, YUV) */
if (codec->pix_fmts) {
@@ -647,7 +647,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
c->qmin = 10;
c->qmax = 51;
}
-
+
/* Keep lossless encodes in the RGB domain. */
if (codec_id == AV_CODEC_ID_HUFFYUV) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
@@ -685,7 +685,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
PRINT("Using global header\n");
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
-
+
/* Determine whether we are encoding interlaced material or not */
if (rd->mode & R_FIELDS) {
PRINT("Encoding interlaced video\n");
@@ -890,7 +890,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int
name, context->ffmpeg_type, context->ffmpeg_codec, context->ffmpeg_audio_codec,
context->ffmpeg_video_bitrate, context->ffmpeg_audio_bitrate,
context->ffmpeg_gop_size, context->ffmpeg_autosplit, rectx, recty);
-
+
exts = get_file_extensions(context->ffmpeg_type);
if (!exts) {
BKE_report(reports, RPT_ERROR, "No valid formats found");
@@ -978,7 +978,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int
goto fail;
}
}
-
+
if (context->ffmpeg_type == FFMPEG_DV) {
fmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000 && rd->ffcodecdata.audio_channels != 2) {
@@ -986,7 +986,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int
goto fail;
}
}
-
+
if (fmt->video_codec != AV_CODEC_ID_NONE) {
context->video_stream = alloc_video_stream(context, rd, fmt->video_codec, of, rectx, recty, error, sizeof(error));
PRINT("alloc video stream %p\n", context->video_stream);
@@ -1072,14 +1072,14 @@ fail:
static void flush_ffmpeg(FFMpegContext *context)
{
int ret = 0;
-
+
AVCodecContext *c = context->video_stream->codec;
/* get the delayed frames */
while (1) {
int got_output;
AVPacket packet = { 0 };
av_init_packet(&packet);
-
+
ret = avcodec_encode_video2(c, &packet, NULL, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding delayed frame %d\n", ret);
@@ -1305,11 +1305,11 @@ static void end_ffmpeg_impl(FFMpegContext *context, int is_autosplit)
PRINT("Flushing delayed frames...\n");
flush_ffmpeg(context);
}
-
+
if (context->outfile) {
av_write_trailer(context->outfile);
}
-
+
/* Close the video codec */
if (context->video_stream != NULL && context->video_stream->codec != NULL) {
@@ -1371,7 +1371,7 @@ void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
{
struct IDProperty *prop = (struct IDProperty *) prop_;
IDProperty *group;
-
+
if (!rd->ffcodecdata.properties) {
return;
}
@@ -1390,17 +1390,17 @@ static IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, con
IDPropertyTemplate val;
int idp_type;
char name[256];
-
+
val.i = 0;
avcodec_get_context_defaults3(&c, NULL);
if (!rd->ffcodecdata.properties) {
- rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg");
+ rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg");
}
group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type);
-
+
if (!group) {
group = IDP_New(IDP_GROUP, &val, type);
IDP_AddToGroup(rd->ffcodecdata.properties, group);
@@ -1460,7 +1460,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
char *name;
char *param;
IDProperty *prop = NULL;
-
+
avcodec_get_context_defaults3(&c, NULL);
BLI_strncpy(name_, str, sizeof(name_));
@@ -1477,7 +1477,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
*param++ = '\0';
while (*param == ' ') param++;
}
-
+
o = av_opt_find(&c, name, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
if (!o) {
PRINT("Ignoring unknown expert option %s\n", str);
@@ -1498,7 +1498,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
else {
prop = BKE_ffmpeg_property_add(rd, (char *) type, o, NULL);
}
-
+
if (!prop) {
return 0;
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index 4757186f546..ebd6de6009e 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -118,7 +118,7 @@ int BKE_frameserver_start(void *context_v, struct Scene *scene, RenderData *UNUS
struct sockaddr_in addr;
int arg = 1;
FrameserverContext *context = context_v;
-
+
(void)scene; /* unused */
if (!startup_socket_system()) {
@@ -210,7 +210,7 @@ static int handle_request(FrameserverContext *context, RenderData *rd, char *req
if (memcmp(req, "GET ", 4) != 0) {
return -1;
}
-
+
p = req + 4;
path = p;
@@ -362,7 +362,7 @@ static void serve_ppm(FrameserverContext *context, int *pixels, int rectx, int r
target[2] = src[2];
target[1] = src[1];
target[0] = src[0];
-
+
target += 3;
src += 4;
}
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index 2e38e33a308..71937531dac 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -38,13 +38,13 @@
/* used for list of strips to accumulate at current time */
typedef struct NlaEvalStrip {
struct NlaEvalStrip *next, *prev;
-
+
NlaTrack *track; /* track that this strip belongs to */
NlaStrip *strip; /* strip that's being used */
-
+
short track_index; /* the index of the track within the list */
short strip_mode; /* which end of the strip are we looking at */
-
+
float strip_time; /* time at which which strip is being evaluated */
} NlaEvalStrip;
@@ -54,7 +54,7 @@ enum eNlaEvalStrip_StripMode {
NES_TIME_BEFORE = -1,
NES_TIME_WITHIN,
NES_TIME_AFTER,
-
+
/* transition-strip evaluations */
NES_TIME_TRANSITION_START,
NES_TIME_TRANSITION_END,
@@ -65,11 +65,11 @@ enum eNlaEvalStrip_StripMode {
// TODO: maybe this will be used as the 'cache' stuff needed for editable values too?
typedef struct NlaEvalChannel {
struct NlaEvalChannel *next, *prev;
-
+
PointerRNA ptr; /* pointer to struct containing property to use */
PropertyRNA *prop; /* RNA-property type to use (should be in the struct given) */
int index; /* array index (where applicable) */
-
+
float value; /* value of this channel */
} NlaEvalChannel;