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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-09-15 04:15:24 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-09-15 04:15:24 +0400
commit41729976753523ee08a0afaf6a26b6caf3dee1d6 (patch)
treeba264fba22084f44eb50b952f375715f501acff9 /source/blender/blenkernel
parenta5f8298ea5d13d7707bc0cbf0722013276bab9d6 (diff)
parenta425790065fedb2ae49f1b79770945d8528790d9 (diff)
Merged changes in the trunk up to revision 50607.
Conflicts resolved: source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h1
-rw-r--r--source/blender/blenkernel/BKE_anim.h2
-rw-r--r--source/blender/blenkernel/BKE_armature.h2
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/BKE_deform.h3
-rw-r--r--source/blender/blenkernel/BKE_image.h10
-rw-r--r--source/blender/blenkernel/BKE_mask.h15
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h7
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/BKE_object_deform.h38
-rw-r--r--source/blender/blenkernel/BKE_script.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h5
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h6
-rw-r--r--source/blender/blenkernel/BKE_tessmesh.h6
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h50
-rw-r--r--source/blender/blenkernel/BKE_world.h3
-rw-r--r--source/blender/blenkernel/CMakeLists.txt2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c49
-rw-r--r--source/blender/blenkernel/intern/action.c10
-rw-r--r--source/blender/blenkernel/intern/anim.c120
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c95
-rw-r--r--source/blender/blenkernel/intern/armature.c57
-rw-r--r--source/blender/blenkernel/intern/blender.c74
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c1
-rw-r--r--source/blender/blenkernel/intern/constraint.c9
-rw-r--r--source/blender/blenkernel/intern/customdata.c1
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c34
-rw-r--r--source/blender/blenkernel/intern/deform.c56
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c1
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c6
-rw-r--r--source/blender/blenkernel/intern/fcurve.c29
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c4
-rw-r--r--source/blender/blenkernel/intern/font.c1
-rw-r--r--source/blender/blenkernel/intern/idprop.c12
-rw-r--r--source/blender/blenkernel/intern/image.c56
-rw-r--r--source/blender/blenkernel/intern/implicit.c4
-rw-r--r--source/blender/blenkernel/intern/key.c16
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/library.c53
-rw-r--r--source/blender/blenkernel/intern/mask.c50
-rw-r--r--source/blender/blenkernel/intern/mask_evaluate.c1
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c40
-rw-r--r--source/blender/blenkernel/intern/mball.c268
-rw-r--r--source/blender/blenkernel/intern/movieclip.c13
-rw-r--r--source/blender/blenkernel/intern/node.c3
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/object_deform.c156
-rw-r--r--source/blender/blenkernel/intern/ocean.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c1
-rw-r--r--source/blender/blenkernel/intern/pointcache.c7
-rw-r--r--source/blender/blenkernel/intern/sca.c1
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c1
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c37
-rw-r--r--source/blender/blenkernel/intern/sequencer.c135
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c4
-rw-r--r--source/blender/blenkernel/intern/softbody.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c1
-rw-r--r--source/blender/blenkernel/intern/text.c3
-rw-r--r--source/blender/blenkernel/intern/texture.c1
-rw-r--r--source/blender/blenkernel/intern/tracking.c2
-rw-r--r--source/blender/blenkernel/intern/world.c10
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c57
64 files changed, 1032 insertions, 620 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 64512dcaac8..fa9223ba6e2 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -698,6 +698,7 @@ void DM_init_origspace(DerivedMesh *dm);
#ifndef NDEBUG
char *DM_debug_info(DerivedMesh *dm);
void DM_debug_print(DerivedMesh *dm);
+void DM_debug_print_cdlayers(CustomData *cdata);
#endif
#endif
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index acb9234b2d4..f506c67a36c 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -60,12 +60,12 @@ void animviz_calc_motionpaths(struct Scene *scene, ListBase *targets);
void free_path(struct Path *path);
void calc_curvepath(struct Object *ob);
-int interval_test(int min, int max, int p1, int cycl);
int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius, float *weight);
/* ---------------------------------------------------- */
/* Dupli-Geometry */
+struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, int update);
struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob);
void free_object_duplilist(struct ListBase *lb);
int count_duplilist(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 44e47e779e7..d750e88ac04 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -101,8 +101,6 @@ void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[][
void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]);
void mat3_to_vec_roll(float mat[][3], float *vec, float *roll);
-int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len);
-
/* Common Conversions Between Co-ordinate Spaces */
void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index dec4d3cb8cb..1e67027ae8c 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 17
+#define BLENDER_SUBVERSION 18
/* 262 was the last editmesh release but its has compatibility code for bmesh data,
* so set the minversion to 2.61 */
@@ -83,6 +83,8 @@ void BKE_userdef_free(void);
void set_blender_test_break_cb(void (*func)(void) );
int blender_test_break(void);
+#define BKE_UNDO_STR_MAX 64
+
/* global undo */
extern void BKE_write_undo(struct bContext *C, const char *name);
extern void BKE_undo_step(struct bContext *C, int step);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 8d486218d21..19dd67b88f8 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -124,8 +124,6 @@ void CustomData_free_temporary(struct CustomData *data, int totelem);
/* adds a data layer of the given type to the CustomData object, optionally
* backed by an external data array. the different allocation types are
* defined above. returns the data of the layer.
- *
- * in editmode, use EDBM_data_layer_add instead of this function
*/
void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
void *layer, int totelem);
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 25677165fc2..52a143ddf55 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -67,7 +67,8 @@ void defvert_remap(struct MDeformVert *dvert, int *map, const int map_len);
void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_normalize(struct MDeformVert *dvert);
-void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
+void defvert_normalize_lock_single(struct MDeformVert *dvert, const int def_nr_lock);
+void defvert_normalize_lock_map(struct MDeformVert *dvert, const char *lock_flags, const int defbase_tot);
/* utility function, note that MAX_VGROUP_NAME chars is the maximum string length since its only
* used with defgroups currently */
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 909ed471081..67461281674 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -106,6 +106,12 @@ struct RenderResult;
#define IMA_TYPE_R_RESULT 4
#define IMA_TYPE_COMPOSITE 5
+enum {
+ IMA_GENTYPE_BLANK = 0,
+ IMA_GENTYPE_GRID = 1,
+ IMA_GENTYPE_GRID_COLOR = 2
+};
+
/* ima->ok */
#define IMA_OK 1
#define IMA_OK_LOADED 2
@@ -196,6 +202,10 @@ int BKE_image_scale(struct Image *image, int width, int height);
/* check if texture has alpha (depth=32) */
int BKE_image_has_alpha(struct Image *image);
+void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height);
+void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]);
+void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
+
/* image_gen.c */
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 9cf5a7f31a5..51e301fec80 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -28,6 +28,8 @@
#ifndef __BKE_MASK_H__
#define __BKE_MASK_H__
+struct ImageUser;
+struct Image;
struct ListBase;
struct Main;
struct Mask;
@@ -100,13 +102,15 @@ struct Mask *BKE_mask_new(const char *name);
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
struct Mask *BKE_mask_copy(struct Mask *mask);
-void BKE_mask_free(struct Mask *mask);
-void BKE_mask_unlink(struct Main *bmain, struct Mask *mask);
+void BKE_mask_free_nolib(struct Mask *mask);
+void BKE_mask_free(struct Main *bmain, struct Mask *mask);
-void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
-void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
+void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
+void BKE_mask_coord_from_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame_size[2]);
+void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
+void BKE_mask_coord_to_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
/* parenting */
@@ -127,7 +131,6 @@ void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSp
void BKE_mask_layer_calc_handles(struct MaskLayer *masklay);
void BKE_mask_layer_calc_handles_deform(struct MaskLayer *masklay);
void BKE_mask_calc_handles(struct Mask *mask);
-void BKE_mask_calc_handles_deform(struct Mask *mask);
void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
/* animation */
@@ -153,8 +156,6 @@ int BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index,
struct MaskSpline **r_masklay_shape, int *r_index);
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline);
-int BKE_mask_layer_shape_spline_index(struct MaskLayer *masklay, int index,
- struct MaskSpline **r_masklay_shape, int *r_index);
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
int do_init, int do_init_interpolate);
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 739b63ca174..25d2678ea47 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -51,9 +51,10 @@ struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struc
struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
struct ImBuf *BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag);
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height);
-int BKE_movieclip_get_duration(struct MovieClip *clip);
-void BKE_movieclip_aspect(struct MovieClip *clip, float *aspx, float *aspy);
-int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
+void BKE_movieclip_get_size_fl(struct MovieClip *clip, struct MovieClipUser *user, float size[2]);
+int BKE_movieclip_get_duration(struct MovieClip *clip);
+void BKE_movieclip_get_aspect(struct MovieClip *clip, float *aspx, float *aspy);
+int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr);
void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *user, struct MovieClipScopes *scopes);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index c8b69898daa..438d5110666 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -546,6 +546,7 @@ struct ShadeResult;
#define SH_NODE_LIGHT_FALLOFF 166
#define SH_NODE_OBJECT_INFO 167
#define SH_NODE_PARTICLE_INFO 168
+#define SH_NODE_TEX_BRICK 169
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1
diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h
new file mode 100644
index 00000000000..ecc521a77fb
--- /dev/null
+++ b/source/blender/blenkernel/BKE_object_deform.h
@@ -0,0 +1,38 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_OBJECT_DEFORM_H__
+#define __BKE_OBJECT_DEFORM_H__
+
+/** \file BKE_object_deform.h
+ * \ingroup bke
+ * \brief Functions for dealing with objects and deform verts,
+ * used by painting and tools.
+ */
+
+struct Object;
+
+char *BKE_objdef_lock_flags_get(struct Object *ob, const int defbase_tot);
+char *BKE_objdef_validmap_get(struct Object *ob, const int defbase_tot);
+char *BKE_objdef_selected_get(struct Object *ob, int defbase_tot, int *r_dg_flags_sel_tot);
+
+#endif /* __BKE_OBJECT_DEFORM_H__ */
diff --git a/source/blender/blenkernel/BKE_script.h b/source/blender/blenkernel/BKE_script.h
index 9976009c4c2..c3789733a04 100644
--- a/source/blender/blenkernel/BKE_script.h
+++ b/source/blender/blenkernel/BKE_script.h
@@ -40,8 +40,6 @@ extern "C" {
struct Script;
-void free_script(struct Script *script);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 2a90bb2c679..51a64c97ca6 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -291,12 +291,13 @@ void BKE_sequencer_dupe_animdata(struct Scene *scene, const char *name_src, cons
int BKE_sequence_base_shuffle(struct ListBase *seqbasep, struct Sequence *test, struct Scene *evil_scene);
int BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene);
int BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase);
-void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, int check_mem_usage, int keep_file_handles);
+void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, int for_render);
struct Sequence *BKE_sequence_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence *seq, int dupe_flag);
int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
int BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur);
void BKE_sequence_invalidate_cache(struct Scene *scene, struct Sequence *seq);
+void BKE_sequence_invalidate_deendent(struct Scene *scene, struct Sequence *seq);
void BKE_sequence_invalidate_cache_for_modifier(struct Scene *scene, struct Sequence *seq);
void BKE_sequencer_update_sound_bounds_all(struct Scene *scene);
@@ -380,7 +381,7 @@ typedef struct SequenceModifierTypeInfo {
void (*copy_data) (struct SequenceModifierData *smd, struct SequenceModifierData *target);
/* apply modifier on a given image buffer */
- struct ImBuf *(*apply) (struct SequenceModifierData *smd, struct ImBuf *ibuf, struct ImBuf *mask);
+ void (*apply) (struct SequenceModifierData *smd, struct ImBuf *ibuf, struct ImBuf *mask);
} SequenceModifierTypeInfo;
struct SequenceModifierTypeInfo *BKE_sequence_modifier_type_info_get(int type);
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index a7b03cef933..d1332ba937e 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -52,7 +52,7 @@ struct DerivedMesh *object_get_derived_final(struct Object *ob);
* the matrix calculation.
*
* A SpaceTransform is initialized using:
- * space_transform_setup( &data, ob1, ob2 )
+ * SPACE_TRANSFORM_SETUP( &data, ob1, ob2 )
*
* After that the following calls can be used:
* space_transform_apply (&data, co); //converts a coordinate in ob1 coords space to the corresponding ob2 coords
@@ -75,7 +75,7 @@ void space_transform_from_matrixs(struct SpaceTransform *data, float local[4][4]
void space_transform_apply(const struct SpaceTransform *data, float co[3]);
void space_transform_invert(const struct SpaceTransform *data, float co[3]);
-#define space_transform_setup(data, local, target) space_transform_from_matrixs(data, (local)->obmat, (target)->obmat)
+#define SPACE_TRANSFORM_SETUP(data, local, target) space_transform_from_matrixs(data, (local)->obmat, (target)->obmat)
/* Shrinkwrap stuff */
#include "BKE_bvhutils.h"
@@ -126,7 +126,7 @@ void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Object
/*
* This function casts a ray in the given BVHTree.. but it takes into consideration the space_transform, that is:
*
- * if transf was configured with "space_transform_setup( &transf, ob1, ob2 )"
+ * if transf was configured with "SPACE_TRANSFORM_SETUP( &transf, ob1, ob2 )"
* then the input (vert, dir, BVHTreeRayHit) must be defined in ob1 coordinates space
* and the BVHTree must be built in ob2 coordinate space.
*
diff --git a/source/blender/blenkernel/BKE_tessmesh.h b/source/blender/blenkernel/BKE_tessmesh.h
index 3a806651d61..dea5e726671 100644
--- a/source/blender/blenkernel/BKE_tessmesh.h
+++ b/source/blender/blenkernel/BKE_tessmesh.h
@@ -72,10 +72,12 @@ typedef struct BMEditMesh {
short selectmode;
short mat_nr;
- /*Mesh structure this editmesh came from, if it came from one*/
- struct Mesh *me;
+ /* Object this editmesh came from (if it came from one) */
struct Object *ob;
+ /* Unused for now, we could bring it back and assign in the same way 'ob' is */
+ // struct Mesh *me;
+
/*temp variables for x-mirror editing*/
int mirror_cdlayer; /* -1 is invalid */
int mirr_free_arrays;
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 0ed2db2aad2..63f5ec59a0b 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -15,13 +15,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
* ***** END GPL LICENSE BLOCK *****
*/
@@ -39,48 +32,7 @@
extern "C" {
#endif
-/* these values need to be hardcoded in structs, dna does not recognize defines */
-/* also defined in DNA_space_types.h */
-#ifndef FILE_MAXDIR
-#define FILE_MAXDIR 768
-#define FILE_MAXFILE 256
-#define FILE_MAX 1024
-#endif
-
-/* this weirdo pops up in two places ... */
-#if !defined(WIN32)
-# ifndef O_BINARY
-# define O_BINARY 0
-# endif
-#endif
-
-/* INTEGER CODES */
-#ifdef __BIG_ENDIAN__
-/* Big Endian */
-# define MAKE_ID(a, b, c, d) ( (int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d) )
-#else
-/* Little Endian */
-# define MAKE_ID(a, b, c, d) ( (int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a) )
-#endif
-
-#define DATA MAKE_ID('D', 'A', 'T', 'A')
-#define GLOB MAKE_ID('G', 'L', 'O', 'B')
-
-#define DNA1 MAKE_ID('D', 'N', 'A', '1')
-#define TEST MAKE_ID('T', 'E', 'S', 'T') /* used as preview between 'REND' and 'GLOB' */
-#define REND MAKE_ID('R', 'E', 'N', 'D')
-#define USER MAKE_ID('U', 'S', 'E', 'R')
-
-#define ENDB MAKE_ID('E', 'N', 'D', 'B')
-
-/* Bit operations */
-#define BTST(a, b) ( ( (a) & 1 << (b) ) != 0)
-#define BNTST(a, b) ( ( (a) & 1 << (b) ) == 0)
-#define BTST2(a, b, c) (BTST( (a), (b) ) || BTST( (a), (c) ) )
-#define BSET(a, b) ( (a) | 1 << (b) )
-#define BCLR(a, b) ( (a) & ~(1 << (b)) )
-/* bit-row */
-#define BROW(min, max) (((max) >= 31 ? 0xFFFFFFFF : (1 << (max + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0) )
+/* currently unused but we may want to add macros here for BKE later */
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index 67896fffc4d..7a23bff0184 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -35,7 +35,8 @@
struct World;
-void BKE_world_free(struct World *sc);
+void BKE_world_free(struct World *sc);
+void BKE_world_free_ex(struct World *sc, int do_id_user);
struct World *add_world(const char *name);
struct World *BKE_world_copy(struct World *wrld);
struct World *localize_world(struct World *wrld);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index d6422e89997..c89d0ecb142 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -116,6 +116,7 @@ set(SRC
intern/nla.c
intern/node.c
intern/object.c
+ intern/object_deform.c
intern/ocean.c
intern/packedFile.c
intern/paint.c
@@ -205,6 +206,7 @@ set(SRC
BKE_nla.h
BKE_node.h
BKE_object.h
+ BKE_object_deform.h
BKE_ocean.h
BKE_packedFile.h
BKE_paint.h
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index a29484638c0..8c0aea5723f 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -59,6 +59,7 @@
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
+#include "BKE_object_deform.h"
#include "BKE_paint.h"
#include "BKE_texture.h"
#include "BKE_multires.h"
@@ -1015,14 +1016,14 @@ static void calc_weightpaint_vert_color(
unsigned char r_col[4],
MDeformVert *dv, ColorBand *coba,
const int defbase_tot, const int defbase_act,
- const char *dg_flags,
- const int selected, const int draw_flag)
+ const char *defbase_sel, const int defbase_sel_tot,
+ const int draw_flag)
{
float input = 0.0f;
int make_black = FALSE;
- if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
+ if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
int was_a_nonzero = FALSE;
unsigned int i;
@@ -1031,7 +1032,7 @@ static void calc_weightpaint_vert_color(
/* in multipaint, get the average if auto normalize is inactive
* get the sum if it is active */
if (dw->def_nr < defbase_tot) {
- if (dg_flags[dw->def_nr]) {
+ if (defbase_sel[dw->def_nr]) {
if (dw->weight) {
input += dw->weight;
was_a_nonzero = TRUE;
@@ -1045,7 +1046,7 @@ static void calc_weightpaint_vert_color(
make_black = TRUE;
}
else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
- input /= selected; /* get the average */
+ input /= defbase_sel_tot; /* get the average */
}
}
else {
@@ -1090,14 +1091,21 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, i
/* variables for multipaint */
const int defbase_tot = BLI_countlist(&ob->defbase);
const int defbase_act = ob->actdef - 1;
- char *dg_flags = MEM_mallocN(defbase_tot * sizeof(char), __func__);
- const int selected = get_selected_defgroups(ob, dg_flags, defbase_tot);
+
+ int defbase_sel_tot = 0;
+ char *defbase_sel = NULL;
+
+ if (draw_flag & CALC_WP_MULTIPAINT) {
+ defbase_sel = BKE_objdef_selected_get(ob, defbase_tot, &defbase_sel_tot);
+ }
for (i = numVerts; i != 0; i--, wc += 4, dv++) {
- calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, dg_flags, selected, draw_flag);
+ calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, defbase_sel, defbase_sel_tot, draw_flag);
}
- MEM_freeN(dg_flags);
+ if (defbase_sel) {
+ MEM_freeN(defbase_sel);
+ }
}
else {
int col_i;
@@ -2073,7 +2081,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
if ((*final_r)->type != DM_TYPE_EDITBMESH) {
DM_ensure_tessface(*final_r);
}
- if (cage_r) {
+ if (cage_r && *cage_r) {
if ((*cage_r)->type != DM_TYPE_EDITBMESH) {
if (*cage_r != *final_r) {
DM_ensure_tessface(*cage_r);
@@ -3187,4 +3195,25 @@ void DM_debug_print(DerivedMesh *dm)
MEM_freeN(str);
}
+void DM_debug_print_cdlayers(CustomData *data)
+{
+ int i;
+ CustomDataLayer *layer;
+
+ printf("{\n");
+
+ for (i = 0, layer = data->layers; i < data->totlayer; i++, layer++) {
+
+ const char *name = CustomData_layertype_name(layer->type);
+ const int size = CustomData_sizeof(layer->type);
+ const char *structname;
+ int structnum;
+ CustomData_file_write_info(layer->type, &structname, &structnum);
+ printf(" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
+ name, structname, layer->type, (void *)layer->data, size, (int)(MEM_allocN_len(layer->data) / size));
+ }
+
+ printf("}\n");
+}
+
#endif /* NDEBUG */
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 6a8ddd8e00a..06bf5211abb 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -526,18 +526,12 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, int copycon)
bPose *outPose;
bPoseChannel *pchan;
ListBase listb;
-
+
if (!src) {
*dst = NULL;
return;
}
- if (*dst == src) {
- printf("BKE_pose_copy_data source and target are the same\n");
- *dst = NULL;
- return;
- }
-
outPose = MEM_callocN(sizeof(bPose), "pose");
BLI_duplicatelist(&outPose->chanbase, &src->chanbase);
@@ -810,7 +804,7 @@ void framechange_poses_clear_unkeyed(void)
/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
/* we only need to do this on objects with a pose */
- if ( (pose = ob->pose) ) {
+ if ((pose = ob->pose)) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone)
pchan->bone->flag &= ~BONE_UNKEYED;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 9b4f0a31e28..1b301ba43b3 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -63,7 +63,6 @@
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
-#include "BKE_utildefines.h"
#include "BKE_tessmesh.h"
#include "BKE_depsgraph.h"
#include "BKE_anim.h"
@@ -75,7 +74,8 @@
/* --------------------- */
/* forward declarations */
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated);
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
+ int level, short animated, short update);
/* ******************************************************************** */
/* Animation Visualization */
@@ -494,36 +494,42 @@ void calc_curvepath(Object *ob)
/* 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 == NULL || ob->type != OB_CURVE) {
+ return;
+ }
cu = ob->data;
- nurbs = BKE_curve_nurbs_get(cu);
- nu = nurbs->first;
-
if (cu->path) free_path(cu->path);
cu->path = NULL;
+ /* weak! can only use first curve */
bl = cu->bev.first;
- if (bl == NULL || !bl->nr) return;
+ if (bl == NULL || !bl->nr) {
+ return;
+ }
+
+ nurbs = BKE_curve_nurbs_get(cu);
+ nu = nurbs->first;
cu->path = path = MEM_callocN(sizeof(Path), "calc_curvepath");
/* if POLY: last vertice != first vertice */
cycl = (bl->poly != -1);
- if (cycl) tot = bl->nr;
- else tot = bl->nr - 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);
+ if (path->len < nu->resolu * SEGMENTSU(nu)) {
+ path->len = nu->resolu * SEGMENTSU(nu);
+ }
dist = (float *)MEM_mallocN((tot + 1) * 4, "calcpathdist");
/* all lengths in *dist */
bevp = bevpfirst = (BevPoint *)(bl + 1);
fp = dist;
- *fp = 0;
+ *fp = 0.0f;
for (a = 0; a < tot; a++) {
fp++;
if (cycl && a == tot - 1)
@@ -558,19 +564,16 @@ void calc_curvepath(Object *ob)
fp++;
if (bevp < bevplast) bevp++;
bevpn = bevp + 1;
- if (bevpn > bevplast) {
- if (cycl) bevpn = bevpfirst;
- else bevpn = bevplast;
+ if (UNLIKELY(bevpn > bevplast)) {
+ bevpn = cycl ? bevpfirst : bevplast;
}
}
- fac1 = *(fp) - *(fp - 1);
- fac2 = *(fp) - d;
- fac1 = fac2 / fac1;
+ fac1 = (*(fp) - d) / (*(fp) - *(fp - 1));
fac2 = 1.0f - fac1;
-
+
interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2);
- pp->vec[3] = fac1 * bevp->alfa + fac2 * bevpn->alfa;
+ pp->vec[3] = fac1 * bevp->alfa + fac2 * bevpn->alfa;
pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius;
pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight;
interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2);
@@ -582,18 +585,14 @@ void calc_curvepath(Object *ob)
MEM_freeN(dist);
}
-
-/* is this only used internally?*/
-int interval_test(int min, int max, int p1, int cycl)
+static int interval_test(const int min, const int max, int p1, const int cycl)
{
if (cycl) {
- if (p1 < min)
- p1 = ((p1 - min) % (max - min + 1)) + max + 1;
- else if (p1 > max)
- p1 = ((p1 - min) % (max - min + 1)) + min;
+ if (p1 < min) p1 = ((p1 - min) % (max - min + 1)) + max + 1;
+ else if (p1 > max) p1 = ((p1 - min) % (max - min + 1)) + min;
}
else {
- if (p1 < min) p1 = min;
+ if (p1 < min) p1 = min;
else if (p1 > max) p1 = max;
}
return p1;
@@ -701,7 +700,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
/* ******************************************************************** */
/* Dupli-Geometry */
-static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int par_index, int type, int animated)
+static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int par_index, int type, short animated)
{
DupliObject *dob = MEM_callocN(sizeof(DupliObject), "dupliobject");
@@ -719,7 +718,8 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
return dob;
}
-static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, int animated)
+static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index,
+ int level, short animated, short update)
{
DupliObject *dob;
Group *group;
@@ -733,8 +733,14 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
if (level > MAX_DUPLI_RECUR) return;
/* handles animated groups, and */
+
/* we need to check update for objects that are not in scene... */
- group_handle_recalc_and_update(scene, ob, group);
+ if (update) {
+ /* note: update is optional because we don't always need object
+ * transformations to be correct. Also fixes bug [#29616]. */
+ group_handle_recalc_and_update(scene, ob, group);
+ }
+
animated = animated || group_is_animated(ob, group);
for (go = group->gobject.first; go; go = go->next) {
@@ -766,14 +772,14 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
if (go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
- object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, par_index, level + 1, animated);
+ object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, par_index, level + 1, animated, update);
copy_m4_m4(dob->ob->obmat, dob->omat);
}
}
}
}
-static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, int animated)
+static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, short animated)
{
extern int enable_cu_speed; /* object.c */
Object copyob;
@@ -845,7 +851,8 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_ind
typedef struct VertexDupliData {
ID *id; /* scene or group, for recursive loops */
int level;
- int animated;
+ short animated;
+ short update;
ListBase *lb;
float pmat[4][4];
float obmat[4][4]; /* Only used for dupliverts inside dupligroups, where the ob->obmat is modified */
@@ -901,12 +908,13 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
float tmpmat[4][4];
copy_m4_m4(tmpmat, vdd->ob->obmat);
copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
- object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->par_index, vdd->level + 1, vdd->animated);
+ object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->par_index, vdd->level + 1, vdd->animated, vdd->update);
copy_m4_m4(vdd->ob->obmat, tmpmat);
}
}
-static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index, int level, int animated)
+static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
+ int level, short animated, short update)
{
Object *ob, *ob_iter;
Mesh *me = par->data;
@@ -926,7 +934,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
/* simple preventing of too deep nested groups */
if (level > MAX_DUPLI_RECUR) return;
- em = me->edit_btmesh;
+ em = BMEdit_FromObject(par);
if (em) {
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
@@ -985,6 +993,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
vdd.id = id;
vdd.level = level;
vdd.animated = animated;
+ vdd.update = update;
vdd.lb = lb;
vdd.ob = ob;
vdd.scene = scene;
@@ -1029,7 +1038,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
dm->release(dm);
}
-static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index, int level, int animated)
+static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
+ int level, short animated, short update)
{
Object *ob, *ob_iter;
Base *base = NULL;
@@ -1052,7 +1062,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
if (level > MAX_DUPLI_RECUR) return;
copy_m4_m4(pmat, par->obmat);
- em = me->edit_btmesh;
+ em = BMEdit_FromObject(par);
if (em) {
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
@@ -1199,7 +1209,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
float tmpmat[4][4];
copy_m4_m4(tmpmat, ob->obmat);
copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
- object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, par_index, level + 1, animated);
+ object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, par_index, level + 1, animated, update);
copy_m4_m4(ob->obmat, tmpmat);
}
}
@@ -1219,7 +1229,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
dm->release(dm);
}
-static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int UNUSED(par_index), ParticleSystem *psys, int level, int animated)
+static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int UNUSED(par_index), ParticleSystem *psys,
+ int level, short animated, short update)
{
GroupObject *go;
Object *ob = NULL, **oblist = NULL, obcopy, *obcopylist = NULL;
@@ -1302,7 +1313,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* gather list of objects or single object */
if (part->ren_as == PART_DRAW_GR) {
- group_handle_recalc_and_update(scene, par, part->dup_group);
+ if (update) {
+ group_handle_recalc_and_update(scene, par, part->dup_group);
+ }
if (part->draw & PART_DRAW_COUNT_GR) {
for (dw = part->dupliweights.first; dw; dw = dw->next)
@@ -1557,7 +1570,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
}
-static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_index, int level, int animated)
+static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_index, int level, short animated)
{
Object *ob, *obar[256] = {NULL};
Curve *cu;
@@ -1605,7 +1618,8 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_inde
/* ------------- */
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated)
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
+ int level, short animated, short update)
{
if ((ob->transflag & OB_DUPLI) == 0)
return;
@@ -1625,11 +1639,11 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
if (ob->transflag & OB_DUPLIPARTS) {
ParticleSystem *psys = ob->particlesystem.first;
for (; psys; psys = psys->next)
- new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, psys, level + 1, animated);
+ new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, psys, level + 1, animated, update);
}
else if (ob->transflag & OB_DUPLIVERTS) {
if (ob->type == OB_MESH) {
- vertex_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated);
+ vertex_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated, update);
}
else if (ob->type == OB_FONT) {
if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
@@ -1639,7 +1653,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
}
else if (ob->transflag & OB_DUPLIFACES) {
if (ob->type == OB_MESH)
- face_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated);
+ face_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated, update);
}
else if (ob->transflag & OB_DUPLIFRAMES) {
if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
@@ -1649,7 +1663,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
else if (ob->transflag & OB_DUPLIGROUP) {
DupliObject *dob;
- group_duplilist(duplilist, scene, ob, par_index, level + 1, animated); /* now recursive */
+ group_duplilist(duplilist, scene, ob, par_index, level + 1, animated, update); /* now recursive */
if (level == 0) {
for (dob = duplilist->first; dob; dob = dob->next)
@@ -1661,14 +1675,22 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
/* Returns a list of DupliObject
* note; group dupli's already set transform matrix. see note in group_duplilist() */
-ListBase *object_duplilist(Scene *sce, Object *ob)
+ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update)
{
ListBase *duplilist = MEM_mallocN(sizeof(ListBase), "duplilist");
duplilist->first = duplilist->last = NULL;
- object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0, 0);
+ object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0, 0, update);
return duplilist;
}
+/* note: previously updating was always done, this is why it defaults to be on
+ * but there are likely places it can be called without updating */
+ListBase *object_duplilist(Scene *sce, Object *ob)
+{
+ return object_duplilist_ex(sce, ob, TRUE);
+}
+
+
void free_object_duplilist(ListBase *lb)
{
DupliObject *dob;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index ea625ec7699..cf785a4bb42 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -59,7 +59,6 @@
#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_report.h"
-#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -622,15 +621,30 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
}
/* Check RNA-Paths for a list of F-Curves */
-static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths)
+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, int verify_paths)
{
FCurve *fcu;
/* we need to check every curve... */
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, oldName, newName, fcu->rna_path, verify_paths);
+ if (fcu->rna_path) {
+ 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) && strcmp(oldName, agrp->name)==0) {
+ BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
+ }
+ }
+ }
}
}
@@ -676,7 +690,8 @@ 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, char *oldName, char *newName, ListBase *strips, int verify_paths)
+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, int verify_paths)
{
NlaStrip *strip;
@@ -684,11 +699,11 @@ static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, char *ol
for (strip = strips->first; strip; strip = strip->next) {
/* fix strip's action */
if (strip->act)
- fcurves_path_rename_fix(owner_id, prefix, oldName, newName, &strip->act->curves, verify_paths);
+ 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, &strip->strips, verify_paths);
+ nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths);
}
}
@@ -718,16 +733,16 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
/* Active action and temp action */
if (adt->action)
- fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->action->curves, verify_paths);
+ 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, oldN, newN, &adt->tmpact->curves, verify_paths);
+ 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, oldN, newN, &nlt->strips, verify_paths);
+ nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths);
/* free the temp names */
MEM_freeN(oldN);
@@ -1152,6 +1167,7 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop)) {
int array_len = RNA_property_array_length(&new_ptr, prop);
+ int written = FALSE;
if (array_len && array_index >= array_len) {
if (G.debug & G_DEBUG) {
@@ -1165,25 +1181,52 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if (array_len)
- RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
- else
- RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
+ if (array_len) {
+ if (RNA_property_boolean_get_index(&new_ptr, prop, array_index) != ANIMSYS_FLOAT_AS_BOOL(value)) {
+ RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_boolean_get(&new_ptr, prop) != ANIMSYS_FLOAT_AS_BOOL(value)) {
+ RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
+ written = TRUE;
+ }
+ }
break;
case PROP_INT:
- if (array_len)
- RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
- else
- RNA_property_int_set(&new_ptr, prop, (int)value);
+ if (array_len) {
+ if (RNA_property_int_get_index(&new_ptr, prop, array_index) != (int)value) {
+ RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_int_get(&new_ptr, prop) != (int)value) {
+ RNA_property_int_set(&new_ptr, prop, (int)value);
+ written = TRUE;
+ }
+ }
break;
case PROP_FLOAT:
- if (array_len)
- RNA_property_float_set_index(&new_ptr, prop, array_index, value);
- else
- RNA_property_float_set(&new_ptr, prop, value);
+ if (array_len) {
+ if (RNA_property_float_get_index(&new_ptr, prop, array_index) != value) {
+ RNA_property_float_set_index(&new_ptr, prop, array_index, value);
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_float_get(&new_ptr, prop) != value) {
+ RNA_property_float_set(&new_ptr, prop, value);
+ written = TRUE;
+ }
+ }
break;
case PROP_ENUM:
- RNA_property_enum_set(&new_ptr, prop, (int)value);
+ if (RNA_property_enum_get(&new_ptr, prop) != (int)value) {
+ RNA_property_enum_set(&new_ptr, prop, (int)value);
+ written = TRUE;
+ }
break;
default:
/* nothing can be done here... so it is unsuccessful? */
@@ -1193,7 +1236,7 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
/* RNA property update disabled for now - [#28525] [#28690] [#28774] [#28777] */
#if 0
/* buffer property update for later flushing */
- if (RNA_property_update_check(prop)) {
+ if (written && RNA_property_update_check(prop)) {
short skip_updates_hack = 0;
/* optimization hacks: skip property updates for those properties
@@ -1213,7 +1256,7 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in
/* as long as we don't do property update, we still tag datablock
* as having been updated. this flag does not cause any updates to
* be run, it's for e.g. render engines to synchronize data */
- if (new_ptr.id.data) {
+ if (written && new_ptr.id.data) {
ID *id = new_ptr.id.data;
id->flag |= LIB_ID_RECALC;
DAG_id_type_tag(G.main, GS(id->name));
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 04585791135..b87342f85fa 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1551,7 +1551,7 @@ void BKE_armature_where_is(bArmature *arm)
static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected)
{
bPose *pose = ob->pose, *frompose = from->pose;
- bPoseChannel *pchan, *pchanp, pchanw;
+ bPoseChannel *pchan, *pchanp;
bConstraint *con;
int error = 0;
@@ -1587,31 +1587,32 @@ 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 regulat cases it shouldn't happen at all */
}
else if (pchan->bone->layer & layer_protected) {
ListBase proxylocal_constraints = {NULL, NULL};
-
+ bPoseChannel pchanw = {NULL};
+
/* copy posechannel to temp, but restore important pointers */
pchanw = *pchanp;
pchanw.prev = pchan->prev;
pchanw.next = pchan->next;
pchanw.parent = pchan->parent;
pchanw.child = pchan->child;
-
+
/* this is freed so copy a copy, else undo crashes */
if (pchanw.prop) {
pchanw.prop = IDP_CopyProperty(pchanw.prop);
-
+
/* use the values from the 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
@@ -1622,30 +1623,30 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints);
copy_constraints(&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) {
bConstraintTypeInfo *cti = constraint_get_typeinfo(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);
-
- /* the final copy */
+
+ /* copy data in temp back over to the cleaned-out (but still allocated) original channel */
*pchan = pchanw;
}
else {
@@ -2516,36 +2517,6 @@ void BKE_pose_where_is(Scene *scene, Object *ob)
}
}
-
-/* Returns total selected vgroups,
- * wpi.defbase_sel is assumed malloc'd, all values are set */
-int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot)
-{
- bDeformGroup *defgroup;
- unsigned int i;
- Object *armob = BKE_object_pose_armature_get(ob);
- int dg_flags_sel_tot = 0;
-
- if (armob) {
- bPose *pose = armob->pose;
- for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(pose, defgroup->name);
- if (pchan && (pchan->bone->flag & BONE_SELECTED)) {
- dg_selection[i] = TRUE;
- dg_flags_sel_tot++;
- }
- else {
- dg_selection[i] = FALSE;
- }
- }
- }
- else {
- memset(dg_selection, FALSE, sizeof(char) * defbase_tot);
- }
-
- return dg_flags_sel_tot;
-}
-
/************** Bounding box ********************/
static int minmax_armature(Object *ob, float r_min[3], float r_max[3])
{
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 0b5d0d90c67..09519f68415 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -44,7 +44,8 @@
#include <stdio.h>
#include <stddef.h>
#include <string.h>
-#include <fcntl.h> // for open
+#include <fcntl.h> /* for open */
+#include <errno.h>
#include "MEM_guardedalloc.h"
@@ -80,13 +81,10 @@
#include "BKE_sound.h"
#include "RE_pipeline.h"
-
#include "BLO_undofile.h"
#include "BLO_readfile.h"
#include "BLO_writefile.h"
-#include "BKE_utildefines.h"
-
#include "RNA_access.h"
#include "WM_api.h" // XXXXX BAD, very BAD dependency (bad level call) - remove asap, elubie
@@ -465,11 +463,10 @@ int blender_test_break(void)
#define UNDO_DISK 0
-#define MAXUNDONAME 64
typedef struct UndoElem {
struct UndoElem *next, *prev;
char str[FILE_MAX];
- char name[MAXUNDONAME];
+ char name[BKE_UNDO_STR_MAX];
MemFile memfile;
uintptr_t undosize;
} UndoElem;
@@ -515,8 +512,13 @@ void BKE_write_undo(bContext *C, const char *name)
int nr /*, success */ /* UNUSED */;
UndoElem *uel;
- if ( (U.uiflag & USER_GLOBALUNDO) == 0) return;
- if (U.undosteps == 0) return;
+ if ((U.uiflag & USER_GLOBALUNDO) == 0) {
+ return;
+ }
+
+ if (U.undosteps == 0) {
+ return;
+ }
/* remove all undos after (also when curundo == NULL) */
while (undobase.last != curundo) {
@@ -717,38 +719,60 @@ void BKE_undo_save_quit(void)
{
UndoElem *uel;
MemFileChunk *chunk;
- int file;
char str[FILE_MAX];
-
- if ( (U.uiflag & USER_GLOBALUNDO) == 0) return;
-
+ const int flag = O_BINARY + O_WRONLY + O_CREAT + O_TRUNC + O_EXCL;
+ int file;
+
+ if ((U.uiflag & USER_GLOBALUNDO) == 0) {
+ return;
+ }
+
uel = curundo;
if (uel == NULL) {
- printf("No undo buffer to save recovery file\n");
+ fprintf(stderr, "No undo buffer to save recovery file\n");
return;
}
-
+
/* no undo state to save */
- if (undobase.first == undobase.last) return;
-
+ if (undobase.first == undobase.last) {
+ return;
+ }
+
+ /* save the undo state as quit.blend */
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
- file = BLI_open(str, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
+ /* first try create the file, if it exists call without 'O_CREAT',
+ * to avoid writing to a symlink - use 'O_EXCL' (CVE-2008-1103) */
+ errno = 0;
+ file = BLI_open(str, flag, 0666);
if (file == -1) {
- //XXX error("Unable to save %s, check you have permissions", str);
+ if (errno == EEXIST) {
+ errno = 0;
+ file = BLI_open(str, flag & ~O_CREAT, 0666);
+ }
+ }
+
+ if (file == -1) {
+ fprintf(stderr, "Unable to save '%s': %s\n",
+ str, errno ? strerror(errno) : "Unknown error opening file");
return;
}
- chunk = uel->memfile.chunks.first;
- while (chunk) {
- if (write(file, chunk->buf, chunk->size) != chunk->size) break;
- chunk = chunk->next;
+ for (chunk = uel->memfile.chunks.first; chunk; chunk = chunk->next) {
+ if (write(file, chunk->buf, chunk->size) != chunk->size) {
+ break;
+ }
}
-
+
close(file);
- if (chunk) ; //XXX error("Unable to save %s, internal error", str);
- else printf("Saved session recovery to %s\n", str);
+ if (chunk) {
+ fprintf(stderr, "Unable to save '%s': %s\n",
+ str, errno ? strerror(errno) : "Unknown error writing file");
+ }
+ else {
+ printf("Saved session recovery to '%s'\n", str);
+ }
}
/* sets curscene */
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 881caec8a58..b176ed429f8 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -50,7 +50,6 @@
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_paint.h"
-#include "BKE_utildefines.h"
#include "BKE_tessmesh.h"
#include "BKE_curve.h"
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 00130dd3583..6b9e0921c3b 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -416,8 +416,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[][4])
{
DerivedMesh *dm = NULL;
- Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = BMEdit_FromObject(ob);
float vec[3] = {0.0f, 0.0f, 0.0f};
float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3];
float imat[3][3], tmat[3][3];
@@ -4292,8 +4291,8 @@ bConstraintTypeInfo *get_constraint_typeinfo(int type)
}
/* only return for valid types */
- if ( (type >= CONSTRAINT_TYPE_NULL) &&
- (type < NUM_CONSTRAINT_TYPES) )
+ if ((type >= CONSTRAINT_TYPE_NULL) &&
+ (type < NUM_CONSTRAINT_TYPES))
{
/* there shouldn't be any segfaults here... */
return constraintsTypeInfo[type];
@@ -4514,7 +4513,7 @@ static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED
* since we've got the actual ID block, let's just inline this
* code.
*
- * See ID_NEW(a) in BKE_utildefines.h
+ * See ID_NEW(a) in DNA_ID.h
*/
if ((*idpoin) && (*idpoin)->newid)
(*idpoin) = (void *)(*idpoin)->newid;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index a00bea38e51..342ee5bba41 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -51,7 +51,6 @@
#include "BLI_mempool.h"
#include "BLI_utildefines.h"
-#include "BKE_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 71801c4729f..78449879f72 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -32,6 +32,7 @@
#include "BLI_fileops.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLI_endian_switch.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
@@ -165,9 +166,9 @@ static int cdf_read_header(CDataFile *cdf)
header->endian = cdf_endian();
if (cdf->switchendian) {
- SWITCH_INT(header->type);
- SWITCH_INT(header->totlayer);
- SWITCH_INT(header->structbytes);
+ BLI_endian_switch_int32(&header->type);
+ BLI_endian_switch_int32(&header->totlayer);
+ BLI_endian_switch_int32(&header->structbytes);
}
if (!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
@@ -185,10 +186,10 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian) {
- SWITCH_INT(image->width);
- SWITCH_INT(image->height);
- SWITCH_INT(image->tile_size);
- SWITCH_INT(image->structbytes);
+ BLI_endian_switch_int32(&image->width);
+ BLI_endian_switch_int32(&image->height);
+ BLI_endian_switch_int32(&image->tile_size);
+ BLI_endian_switch_int32(&image->structbytes);
}
offset += image->structbytes;
@@ -200,7 +201,7 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian)
- SWITCH_INT(mesh->structbytes);
+ BLI_endian_switch_int32(&mesh->structbytes);
offset += mesh->structbytes;
mesh->structbytes = sizeof(CDataFileMeshHeader);
@@ -219,10 +220,10 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian) {
- SWITCH_INT(layer->type);
- SWITCH_INT(layer->datatype);
- SWITCH_INT64(layer->datasize);
- SWITCH_INT(layer->structbytes);
+ BLI_endian_switch_int32(&layer->type);
+ BLI_endian_switch_int32(&layer->datatype);
+ BLI_endian_switch_uint64(&layer->datasize);
+ BLI_endian_switch_int32(&layer->structbytes);
}
if (layer->datatype != CDF_DATA_FLOAT)
@@ -317,20 +318,13 @@ int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
{
- float *fdata;
- unsigned int a;
-
/* read data */
if (!fread(data, size, 1, cdf->readf))
return 0;
/* switch endian if necessary */
if (cdf->switchendian) {
- fdata = data;
-
- for (a = 0; a < size / sizeof(float); a++) {
- SWITCH_INT(fdata[a]);
- }
+ BLI_endian_switch_float_array(data, size / sizeof(float));
}
return 1;
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 547a64a70d4..4110d4565b2 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <math.h>
#include <ctype.h>
+#include <stdlib.h>
#include "MEM_guardedalloc.h"
@@ -41,7 +42,10 @@
#include "BKE_deform.h"
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -204,13 +208,15 @@ void defvert_normalize(MDeformVert *dvert)
}
}
-void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
+void defvert_normalize_lock_single(MDeformVert *dvert, const int def_nr_lock)
{
if (dvert->totweight <= 0) {
/* nothing */
}
else if (dvert->totweight == 1) {
- dvert->dw[0].weight = 1.0f;
+ if (def_nr_lock != 0) {
+ dvert->dw[0].weight = 1.0f;
+ }
}
else {
MDeformWeight *dw_lock = NULL;
@@ -246,6 +252,50 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
}
}
+void defvert_normalize_lock_map(MDeformVert *dvert, const char *lock_flags, const int defbase_tot)
+{
+ if (dvert->totweight <= 0) {
+ /* nothing */
+ }
+ else if (dvert->totweight == 1) {
+ if (LIKELY(defbase_tot >= 1) && lock_flags[0]) {
+ dvert->dw[0].weight = 1.0f;
+ }
+ }
+ else {
+ MDeformWeight *dw;
+ unsigned int i;
+ float tot_weight = 0.0f;
+ float lock_iweight = 0.0f;
+
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+ if ((dw->def_nr < defbase_tot) && (lock_flags[dw->def_nr] == FALSE)) {
+ tot_weight += dw->weight;
+ }
+ else {
+ /* invert after */
+ lock_iweight += dw->weight;
+ }
+ }
+
+ lock_iweight = maxf(0.0f, 1.0f - lock_iweight);
+
+ if (tot_weight > 0.0f) {
+ /* paranoid, should be 1.0 but in case of float error clamp anyway */
+
+ float scalar = (1.0f / tot_weight) * lock_iweight;
+ for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+ if ((dw->def_nr < defbase_tot) && (lock_flags[dw->def_nr] == FALSE)) {
+ dw->weight *= scalar;
+
+ /* in case of division errors with very low weights */
+ CLAMP(dw->weight, 0.0f, 1.0f);
+ }
+ }
+ }
+ }
+}
+
void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
{
MDeformWeight *dw;
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 1b53f8980cb..b8d5294eabc 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -75,7 +75,6 @@
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_tracking.h"
-#include "BKE_utildefines.h"
#include "depsgraph_private.h"
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 06807dfcbad..f47ac641cf9 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2595,7 +2595,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
char output_file[FILE_MAX];
- if (!sData || !sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; }
+ if (!sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; }
/* if selected format is openexr, but current build doesnt support one */
#ifndef WITH_OPENEXR
if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
@@ -4800,7 +4800,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
PaintBakeData *bData = sData->bData;
DynamicPaintCanvasSettings *canvas = surface->canvas;
int ret = 1;
- if (!sData || sData->total_points < 1) return 0;
+ if (sData->total_points < 1) return 0;
dynamicPaint_surfacePreStep(surface, timescale);
/*
@@ -4875,7 +4875,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* Apply brush on the surface depending on it's collision type */
/* Particle brush: */
if (brush->collision == MOD_DPAINT_COL_PSYS) {
- if (brush && brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER &&
+ if (brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER &&
psys_check_enabled(brushObj, brush->psys))
{
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index c6ba6a0d841..befec1907da 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1747,5 +1747,11 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em,
BMEditMesh *BMEdit_FromObject(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
+ /* sanity check */
+#ifndef NDEBUG
+ if (((Mesh *)ob->data)->edit_btmesh) {
+ BLI_assert(((Mesh *)ob->data)->edit_btmesh->ob == ob);
+ }
+#endif
return ((Mesh *)ob->data)->edit_btmesh;
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 53c12d32bc1..2dbc63e6944 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -55,7 +55,6 @@
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_object.h"
-#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -75,12 +74,10 @@ void free_fcurve(FCurve *fcu)
{
if (fcu == NULL)
return;
-
+
/* free curve data */
- if (fcu) {
- if (fcu->bezt) MEM_freeN(fcu->bezt);
- if (fcu->fpt) MEM_freeN(fcu->fpt);
- }
+ if (fcu->bezt) MEM_freeN(fcu->bezt);
+ if (fcu->fpt) MEM_freeN(fcu->fpt);
/* free RNA-path, as this were allocated when getting the path string */
if (fcu->rna_path)
@@ -507,8 +504,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]);
}
else {
- xminv = MIN2(xminv, bezt_first->vec[1][0]);
- xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
+ xminv = minf(xminv, bezt_first->vec[1][0]);
+ xmaxv = maxf(xmaxv, bezt_last->vec[1][0]);
}
}
}
@@ -524,8 +521,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
}
else {
- yminv = MIN2(yminv, bezt->vec[1][1]);
- ymaxv = MAX2(ymaxv, bezt->vec[1][1]);
+ yminv = minf(yminv, bezt->vec[1][1]);
+ ymaxv = maxf(ymaxv, bezt->vec[1][1]);
}
foundvert = TRUE;
@@ -536,8 +533,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
else if (fcu->fpt) {
/* frame range can be directly calculated from end verts */
if (xmin || xmax) {
- xminv = MIN2(xminv, fcu->fpt[0].vec[0]);
- xmaxv = MAX2(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
+ xminv = minf(xminv, fcu->fpt[0].vec[0]);
+ xmaxv = maxf(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
}
/* only loop over keyframes to find extents for values if needed */
@@ -594,15 +591,15 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end,
if (bezt_first) {
BLI_assert(bezt_last != NULL);
- min = MIN2(min, bezt_first->vec[1][0]);
- max = MAX2(max, bezt_last->vec[1][0]);
+ min = minf(min, bezt_first->vec[1][0]);
+ max = maxf(max, bezt_last->vec[1][0]);
foundvert = TRUE;
}
}
else if (fcu->fpt) {
- min = MIN2(min, fcu->fpt[0].vec[0]);
- max = MAX2(max, fcu->fpt[fcu->totvert - 1].vec[0]);
+ min = minf(min, fcu->fpt[0].vec[0]);
+ max = maxf(max, fcu->fpt[fcu->totvert - 1].vec[0]);
foundvert = TRUE;
}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 438188b1e2a..538d2469a93 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -965,8 +965,8 @@ FModifierTypeInfo *get_fmodifier_typeinfo(int type)
}
/* only return for valid types */
- if ( (type >= FMODIFIER_TYPE_NULL) &&
- (type <= FMODIFIER_NUM_TYPES) )
+ if ((type >= FMODIFIER_TYPE_NULL) &&
+ (type < FMODIFIER_NUM_TYPES))
{
/* there shouldn't be any segfaults here... */
return fmodifiersTypeInfo[type];
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 0ffd68c9079..8b35974ea62 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -50,7 +50,6 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
-#include "BKE_utildefines.h"
#include "BKE_packedFile.h"
#include "BKE_library.h"
#include "BKE_font.h"
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 7456f9aab8b..8229df28ab8 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -293,18 +293,6 @@ static IDProperty *IDP_CopyArray(IDProperty *prop)
return newp;
}
-/*taken from readfile.c*/
-#define SWITCH_LONGINT(a) { \
- char s_i, *p_i; \
- p_i = (char *)& (a); \
- s_i = p_i[0]; p_i[0] = p_i[7]; p_i[7] = s_i; \
- s_i = p_i[1]; p_i[1] = p_i[6]; p_i[6] = s_i; \
- s_i = p_i[2]; p_i[2] = p_i[5]; p_i[5] = s_i; \
- s_i = p_i[3]; p_i[3] = p_i[4]; p_i[4] = s_i; \
- } (void)0
-
-
-
/* ---------- String Type ------------ */
IDProperty *IDP_NewString(const char *st, const char *name, int maxlen)
{
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 2b2128439c7..3f756e74b26 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -79,7 +79,6 @@
#include "BKE_scene.h"
#include "BKE_node.h"
#include "BKE_sequencer.h" /* seq_foreground_frame_get() */
-#include "BKE_utildefines.h"
#include "BLF_api.h"
@@ -595,7 +594,7 @@ Image *BKE_image_load_exists(const char *filepath)
return BKE_image_load(filepath);
}
-static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4])
+static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
{
ImBuf *ibuf;
unsigned char *rect = NULL;
@@ -615,11 +614,11 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
ibuf->userflags |= IB_BITMAPDIRTY;
- switch (uvtestgrid) {
- case 1:
+ switch (gen_type) {
+ case IMA_GENTYPE_GRID:
BKE_image_buf_fill_checker(rect, rect_float, width, height);
break;
- case 2:
+ case IMA_GENTYPE_GRID_COLOR:
BKE_image_buf_fill_checker_color(rect, rect_float, width, height);
break;
default:
@@ -630,7 +629,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
}
/* adds new image block, creates ImBuf and initializes color */
-Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4])
+Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
{
/* on save, type is changed to FILE in editsima.c */
Image *ima = image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
@@ -641,10 +640,10 @@ Image *BKE_image_add_generated(unsigned int width, unsigned int height, const ch
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
ima->gen_x = width;
ima->gen_y = height;
- ima->gen_type = uvtestgrid;
+ ima->gen_type = gen_type;
ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
- ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, uvtestgrid, color);
+ ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
@@ -2527,7 +2526,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
dither = iuser->scene->r.dither_intensity;
/* combined layer gets added as first layer */
- if (rres.have_combined && layer == 0) ;
+ if (rres.have_combined && layer == 0) {
+ /* pass */
+ }
else if (rres.layers.first) {
RenderLayer *rl = BLI_findlink(&rres.layers, layer - (rres.have_combined ? 1 : 0));
if (rl) {
@@ -2930,3 +2931,40 @@ int BKE_image_has_alpha(struct Image *image)
else
return 0;
}
+
+void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
+{
+ ImBuf *ibuf = NULL;
+ void *lock;
+
+ ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
+
+ if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
+ *width = ibuf->x;
+ *height = ibuf->y;
+ }
+ else {
+ *width = IMG_SIZE_FALLBACK;
+ *height = IMG_SIZE_FALLBACK;
+ }
+
+ BKE_image_release_ibuf(image, lock);
+}
+
+void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2])
+{
+ int width, height;
+ BKE_image_get_size(image, iuser, &width, &height);
+
+ size[0] = (float)width;
+ size[1] = (float)height;
+
+}
+
+void BKE_image_get_aspect(Image *image, float *aspx, float *aspy)
+{
+ *aspx = 1.0;
+
+ /* x is always 1 */
+ *aspy = image->aspy / image->aspx;
+}
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 616214c21ff..1c6974b2615 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -193,7 +193,7 @@ DO_INLINE lfVector *create_lfvector(unsigned int verts)
DO_INLINE void del_lfvector(float (*fLongVector)[3])
{
if (fLongVector != NULL) {
- MEM_freeN (fLongVector);
+ MEM_freeN(fLongVector);
// cloth_aligned_free(&MEMORY_BASE, fLongVector);
}
}
@@ -523,7 +523,7 @@ DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs)
DO_INLINE void del_bfmatrix(fmatrix3x3 *matrix)
{
if (matrix != NULL) {
- MEM_freeN (matrix);
+ MEM_freeN(matrix);
}
}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 17a3c595ea7..b79608342dd 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -691,8 +691,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
if (nu->bp) {
step = nu->pntsu * nu->pntsv;
- a1 = MAX2(a, start);
- a2 = MIN2(a + step, end);
+ a1 = maxi(a, start);
+ a2 = mini(a + step, end);
if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
}
@@ -700,8 +700,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
step = 3 * nu->pntsu;
/* exception because keys prefer to work with complete blocks */
- a1 = MAX2(a, start);
- a2 = MIN2(a + step, end);
+ a1 = maxi(a, start);
+ a2 = mini(a + step, end);
if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
}
@@ -1217,7 +1217,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
remain = step;
}
- count = MIN2(remain, estep);
+ count = mini(remain, estep);
if (mode == KEY_MODE_BEZTRIPLE) {
count += 3 - count % 3;
}
@@ -1573,7 +1573,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
fp = kb->data;
tot = lt->pntsu * lt->pntsv * lt->pntsw;
- tot = MIN2(kb->totelem, tot);
+ tot = mini(kb->totelem, tot);
for (a = 0; a < tot; a++, fp += 3, bp++) {
copy_v3_v3(bp->vec, fp);
@@ -1645,7 +1645,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
tot = BKE_nurbList_verts_count(nurb);
- tot = MIN2(kb->totelem, tot);
+ tot = mini(kb->totelem, tot);
while (nu && tot > 0) {
@@ -1713,7 +1713,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
mvert = me->mvert;
fp = kb->data;
- tot = MIN2(kb->totelem, me->totvert);
+ tot = mini(kb->totelem, me->totvert);
for (a = 0; a < tot; a++, fp += 3, mvert++) {
copy_v3_v3(mvert->co, fp);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 0e73d10fa5f..17e4103c7d3 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -488,7 +488,7 @@ static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir
/* test for cyclic */
bl = cu->bev.first;
if (!bl->nr) return 0;
- if (bl && bl->poly > -1) cycl = 1;
+ if (bl->poly > -1) cycl = 1;
if (cycl == 0) {
ctime1 = CLAMPIS(ctime, 0.0f, 1.0f);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 77e7623ae3d..f6e86bdbb5a 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -107,7 +107,6 @@
#include "BKE_gpencil.h"
#include "BKE_fcurve.h"
#include "BKE_speaker.h"
-#include "BKE_utildefines.h"
#include "BKE_movieclip.h"
#include "BKE_mask.h"
#include "BKE_linestyle.h"
@@ -813,6 +812,7 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata
/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */
void BKE_libblock_free(ListBase *lb, void *idv)
{
+ Main *bmain = G.main; /* should eventually be an arg */
ID *id = idv;
#ifdef WITH_PYTHON
@@ -875,7 +875,7 @@ void BKE_libblock_free(ListBase *lb, void *idv)
BKE_text_free((Text *)id);
break;
case ID_SCRIPT:
- //XXX free_script((Script *)id);
+ /* deprecated */
break;
case ID_SPK:
BKE_speaker_free((Speaker *)id);
@@ -912,7 +912,7 @@ void BKE_libblock_free(ListBase *lb, void *idv)
BKE_movieclip_free((MovieClip *)id);
break;
case ID_MSK:
- BKE_mask_free((Mask *)id);
+ BKE_mask_free(bmain, (Mask *)id);
break;
case ID_LS:
FRS_free_linestyle((FreestyleLineStyle *)id);
@@ -927,7 +927,7 @@ void BKE_libblock_free(ListBase *lb, void *idv)
BLI_remlink(lb, id);
/* this ID may be a driver target! */
- BKE_animdata_main_cb(G.main, animdata_dtar_clear_cb, (void *)id);
+ BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
MEM_freeN(id);
}
@@ -962,9 +962,52 @@ void free_main(Main *mainvar)
ID *id;
while ( (id = lb->first) ) {
+#if 1
BKE_libblock_free(lb, id);
+#else
+ /* errors freeing ID's can be hard to track down,
+ * enable this so valgrind will give the line number in its error log */
+ switch (a) {
+ case 0: BKE_libblock_free(lb, id); break;
+ case 1: BKE_libblock_free(lb, id); break;
+ case 2: BKE_libblock_free(lb, id); break;
+ case 3: BKE_libblock_free(lb, id); break;
+ case 4: BKE_libblock_free(lb, id); break;
+ case 5: BKE_libblock_free(lb, id); break;
+ case 6: BKE_libblock_free(lb, id); break;
+ case 7: BKE_libblock_free(lb, id); break;
+ case 8: BKE_libblock_free(lb, id); break;
+ case 9: BKE_libblock_free(lb, id); break;
+ case 10: BKE_libblock_free(lb, id); break;
+ case 11: BKE_libblock_free(lb, id); break;
+ case 12: BKE_libblock_free(lb, id); break;
+ case 13: BKE_libblock_free(lb, id); break;
+ case 14: BKE_libblock_free(lb, id); break;
+ case 15: BKE_libblock_free(lb, id); break;
+ case 16: BKE_libblock_free(lb, id); break;
+ case 17: BKE_libblock_free(lb, id); break;
+ case 18: BKE_libblock_free(lb, id); break;
+ case 19: BKE_libblock_free(lb, id); break;
+ case 20: BKE_libblock_free(lb, id); break;
+ case 21: BKE_libblock_free(lb, id); break;
+ case 22: BKE_libblock_free(lb, id); break;
+ case 23: BKE_libblock_free(lb, id); break;
+ case 24: BKE_libblock_free(lb, id); break;
+ case 25: BKE_libblock_free(lb, id); break;
+ case 26: BKE_libblock_free(lb, id); break;
+ case 27: BKE_libblock_free(lb, id); break;
+ case 28: BKE_libblock_free(lb, id); break;
+ case 29: BKE_libblock_free(lb, id); break;
+ case 30: BKE_libblock_free(lb, id); break;
+ case 31: BKE_libblock_free(lb, id); break;
+ case 32: BKE_libblock_free(lb, id); break;
+ default:
+ BLI_assert(0);
+ }
+#endif
}
}
+ a = set_listbasepointers(mainvar, lbarray);
MEM_freeN(mainvar);
}
@@ -1543,7 +1586,7 @@ void BKE_library_filepath_set(Library *lib, const char *filepath)
/* not essential but set filepath is an absolute copy of value which
* is more useful if its kept in sync */
- if (strncmp(lib->filepath, "//", 2) == 0) {
+ if (BLI_path_is_rel(lib->filepath)) {
/* note that the file may be unsaved, in this case, setting the
* filepath on an indirectly linked path is not allowed from the
* outliner, and its not really supported but allow from here for now
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index f73fb3879b8..97b46d4829d 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -55,6 +55,7 @@
#include "BKE_sequencer.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
+#include "BKE_image.h"
static MaskSplinePoint *mask_spline_point_next(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
{
@@ -909,7 +910,8 @@ void BKE_mask_layer_free_list(ListBase *masklayers)
}
}
-void BKE_mask_free(Mask *mask)
+/** free for temp copy, but don't manage unlinking from other pointers */
+void BKE_mask_free_nolib(Mask *mask)
{
BKE_mask_layer_free_list(&mask->masklayers);
}
@@ -927,7 +929,7 @@ static void ntree_unlink_mask_cb(void *calldata, struct ID *UNUSED(owner_id), st
}
}
-void BKE_mask_unlink(Main *bmain, Mask *mask)
+void BKE_mask_free(Main *bmain, Mask *mask)
{
bScreen *scr;
ScrArea *area;
@@ -990,7 +992,8 @@ void BKE_mask_unlink(Main *bmain, Mask *mask)
treetype->foreach_nodetree(bmain, (void *)mask, &ntree_unlink_mask_cb);
}
- BKE_libblock_free(&bmain->mask, mask);
+ /* free mask data */
+ BKE_mask_layer_free_list(&mask->masklayers);
}
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
@@ -1010,14 +1013,26 @@ void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float fra
}
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
{
- int width, height;
+ float aspx, aspy;
float frame_size[2];
/* scaling for the clip */
- BKE_movieclip_get_size(clip, user, &width, &height);
+ BKE_movieclip_get_size_fl(clip, user, frame_size);
+ BKE_movieclip_get_aspect(clip, &aspx, &aspy);
+
+ frame_size[1] *= (aspy / aspx);
+
+ BKE_mask_coord_from_frame(r_co, co, frame_size);
+}
+void BKE_mask_coord_from_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
+{
+ float aspx, aspy;
+ float frame_size[2];
+
+ BKE_image_get_size_fl(image, iuser, frame_size);
+ BKE_image_get_aspect(image, &aspx, &aspy);
- frame_size[0] = (float)width;
- frame_size[1] = (float)height;
+ frame_size[1] *= (aspy / aspx);
BKE_mask_coord_from_frame(r_co, co, frame_size);
}
@@ -1040,14 +1055,27 @@ void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame
}
void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
{
- int width, height;
+ float aspx, aspy;
+ float frame_size[2];
+
+ /* scaling for the clip */
+ BKE_movieclip_get_size_fl(clip, user, frame_size);
+ BKE_movieclip_get_aspect(clip, &aspx, &aspy);
+
+ frame_size[1] /= (aspy / aspx);
+
+ BKE_mask_coord_to_frame(r_co, co, frame_size);
+}
+void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
+{
+ float aspx, aspy;
float frame_size[2];
/* scaling for the clip */
- BKE_movieclip_get_size(clip, user, &width, &height);
+ BKE_image_get_size_fl(image, iuser, frame_size);
+ BKE_image_get_aspect(image, &aspx, &aspy);
- frame_size[0] = (float)width;
- frame_size[1] = (float)height;
+ frame_size[1] /= (aspy / aspx);
BKE_mask_coord_to_frame(r_co, co, frame_size);
}
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index 065dc38c81e..4a8601df0b8 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -61,7 +61,6 @@
#include "BKE_sequencer.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
-#include "BKE_utildefines.h"
unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index eb96d6726b9..18617f0ef2e 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -26,6 +26,46 @@
/** \file blender/blenkernel/intern/mask_rasterize.c
* \ingroup bke
+ *
+ * This module exposes a rasterizer that works as a black box - implementation details are confined to this file,
+ *
+ * The basic method to access is:
+ * - create & initialize a handle from a #Mask datablock.
+ * - execute pixel lookups.
+ * - free the handle.
+ *
+ * This file is admittedly a bit confusticated, in quite few areas speed was chosen over readability,
+ * though it is commented - so shouldn't be so hard to see whats going on.
+ *
+ *
+ * Implementation:
+ *
+ * To rasterize the mask its converted into geometry that use a ray-cast for each pixel lookup.
+ *
+ * Initially 'kdopbvh' was used but this ended up being too slow.
+ *
+ * To gain some extra speed we take advantage of a few shortcuts that can be made rasterizing masks specifically.
+ * - all triangles are known to be completely white - so no depth check is done on triangle intersection.
+ * - all quads are known to be feather outlines - the 1 and 0 depths are known by the vertex order in the quad,
+ * - there is no color - just a value for each mask pixel.
+ * - the mask spacial structure always maps to space 0-1 on X and Y axis.
+ * - bucketing is used to speed up lookups for geometry.
+ *
+ * Other Details:
+ * - used unsigned values all over for some extra speed on some arch's.
+ * - anti-aliasing is faked, just ensuring at least one pixel feather - avoids oversampling.
+ * - initializing the spacial structure doesn't need to be as optimized as pixel lookups are.
+ * - mask lookups need not be pixel aligned so any sub-pixel values from x/y (0 - 1), can be found.
+ * (perhaps masks can be used as a vector texture in 3D later on)
+ *
+ *
+ * Currently, to build the spacial structure we have to calculate the total number of faces ahead of time.
+ *
+ * This is getting a bit complicated with the addition of unfilled splines and end capping -
+ * If large changes are needed here we would be better off using an iterable
+ * BLI_mempool for triangles and converting to a contiguous array afterwards.
+ *
+ * - Campbell
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index a92497ffb9d..3925c3cc858 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -157,17 +157,19 @@ struct pgn_elements {
/* Forward declarations */
static int vertid(const CORNER *c1, const CORNER *c2, PROCESS *p, MetaBall *mb);
-static int setcenter(CENTERLIST *table[], int i, int j, int k);
+static int setcenter(CENTERLIST *table[], const int i, const int j, const int k);
static CORNER *setcorner(PROCESS *p, int i, int j, int k);
static void converge(const float p1[3], const float p2[3], float v1, float v2,
float (*function)(float, float, float), float p[3], MetaBall *mb, int f);
/* Global variables */
+static struct {
+ float thresh;
+ int totelem;
+ MetaElem **mainb;
+ octal_tree *metaball_tree;
+} G_mb = {0};
-static float thresh = 0.6f;
-static int totelem = 0;
-static MetaElem **mainb;
-static octal_tree *metaball_tree = NULL;
/* Functions */
void BKE_mball_unlink(MetaBall *mb)
@@ -523,7 +525,7 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.');
- totelem = 0;
+ G_mb.totelem = 0;
/* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */
if (F_ERROR == BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL))
@@ -564,9 +566,10 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
}
}
- while (ml) {
- if (!(ml->flag & MB_HIDE)) totelem++;
- ml = ml->next;
+ for ( ; ml; ml = ml->next) {
+ if (!(ml->flag & MB_HIDE)) {
+ G_mb.totelem++;
+ }
}
}
}
@@ -637,21 +640,6 @@ static float densfunc(MetaElem *ball, float x, float y, float z)
case MB_BALL:
/* do nothing */
break;
- case MB_TUBEX:
- if (dvec[0] > ball->len) dvec[0] -= ball->len;
- else if (dvec[0] < -ball->len) dvec[0] += ball->len;
- else dvec[0] = 0.0;
- break;
- case MB_TUBEY:
- if (dvec[1] > ball->len) dvec[1] -= ball->len;
- else if (dvec[1] < -ball->len) dvec[1] += ball->len;
- else dvec[1] = 0.0;
- break;
- case MB_TUBEZ:
- if (dvec[2] > ball->len) dvec[2] -= ball->len;
- else if (dvec[2] < -ball->len) dvec[2] += ball->len;
- else dvec[2] = 0.0;
- break;
case MB_TUBE:
if (dvec[0] > ball->expx) dvec[0] -= ball->expx;
else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
@@ -683,6 +671,24 @@ static float densfunc(MetaElem *ball, float x, float y, float z)
else if (dvec[2] < -ball->expz) dvec[2] += ball->expz;
else dvec[2] = 0.0;
break;
+
+ /* *** deprecated, could be removed?, do-versioned at least *** */
+ case MB_TUBEX:
+ if (dvec[0] > ball->len) dvec[0] -= ball->len;
+ else if (dvec[0] < -ball->len) dvec[0] += ball->len;
+ else dvec[0] = 0.0;
+ break;
+ case MB_TUBEY:
+ if (dvec[1] > ball->len) dvec[1] -= ball->len;
+ else if (dvec[1] < -ball->len) dvec[1] += ball->len;
+ else dvec[1] = 0.0;
+ break;
+ case MB_TUBEZ:
+ if (dvec[2] > ball->len) dvec[2] -= ball->len;
+ else if (dvec[2] < -ball->len) dvec[2] += ball->len;
+ else dvec[2] = 0.0;
+ break;
+ /* *** end deprecated *** */
}
dist2 = 1.0f - (len_v3(dvec) / ball->rad2);
@@ -771,27 +777,27 @@ static float metaball(float x, float y, float z)
float dens = 0;
int a;
- if (totelem > 1) {
- node = find_metaball_octal_node(metaball_tree->first, x, y, z, metaball_tree->depth);
+ if (G_mb.totelem > 1) {
+ node = find_metaball_octal_node(G_mb.metaball_tree->first, x, y, z, G_mb.metaball_tree->depth);
if (node) {
for (ml_p = node->elems.first; ml_p; ml_p = ml_p->next) {
dens += densfunc(ml_p->ml, x, y, z);
}
- dens += -0.5f * (metaball_tree->pos - node->pos);
- dens += 0.5f * (metaball_tree->neg - node->neg);
+ dens += -0.5f * (G_mb.metaball_tree->pos - node->pos);
+ dens += 0.5f * (G_mb.metaball_tree->neg - node->neg);
}
else {
- for (a = 0; a < totelem; a++) {
- dens += densfunc(mainb[a], x, y, z);
+ for (a = 0; a < G_mb.totelem; a++) {
+ dens += densfunc(G_mb.mainb[a], x, y, z);
}
}
}
else {
- dens += densfunc(mainb[0], x, y, z);
+ dens += densfunc(G_mb.mainb[0], x, y, z);
}
- return thresh - dens;
+ return G_mb.thresh - dens;
}
/* ******************************************** */
@@ -1493,7 +1499,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
MetaElem *ml;
float f = 0.0f;
- ml = mainb[a];
+ ml = G_mb.mainb[a];
f = 1.0 - (mb->thresh / ml->s);
/* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
@@ -1619,7 +1625,7 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
mbproc->edges = MEM_callocN(2 * HASHSIZE * sizeof(EDGELIST *), "mbproc->edges");
makecubetable();
- for (a = 0; a < totelem; a++) {
+ for (a = 0; a < G_mb.totelem; a++) {
/* try to find 8 points on the surface for each MetaElem */
find_first_points(mbproc, mb, a);
@@ -1712,7 +1718,7 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
ml_count++;
ml = ml->next;
}
- totelem -= ml_count;
+ G_mb.totelem -= ml_count;
}
else {
while (ml) {
@@ -1741,9 +1747,9 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
mult_m4_m4m4(temp1, temp2, temp3);
/* make a copy because of duplicates */
- mainb[a] = new_pgn_element(sizeof(MetaElem));
- *(mainb[a]) = *ml;
- mainb[a]->bb = new_pgn_element(sizeof(BoundBox));
+ G_mb.mainb[a] = new_pgn_element(sizeof(MetaElem));
+ *(G_mb.mainb[a]) = *ml;
+ G_mb.mainb[a]->bb = new_pgn_element(sizeof(BoundBox));
mat = new_pgn_element(4 * 4 * sizeof(float));
imat = new_pgn_element(4 * 4 * sizeof(float));
@@ -1756,70 +1762,70 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
invert_m4_m4(imat, mat);
- mainb[a]->rad2 = ml->rad * ml->rad;
+ G_mb.mainb[a]->rad2 = ml->rad * ml->rad;
- mainb[a]->mat = (float *) mat;
- mainb[a]->imat = (float *) imat;
+ G_mb.mainb[a]->mat = (float *) mat;
+ G_mb.mainb[a]->imat = (float *) imat;
/* untransformed Bounding Box of MetaElem */
/* 0 */
- mainb[a]->bb->vec[0][0] = -ml->expx;
- mainb[a]->bb->vec[0][1] = -ml->expy;
- mainb[a]->bb->vec[0][2] = -ml->expz;
+ G_mb.mainb[a]->bb->vec[0][0] = -ml->expx;
+ G_mb.mainb[a]->bb->vec[0][1] = -ml->expy;
+ G_mb.mainb[a]->bb->vec[0][2] = -ml->expz;
/* 1 */
- mainb[a]->bb->vec[1][0] = ml->expx;
- mainb[a]->bb->vec[1][1] = -ml->expy;
- mainb[a]->bb->vec[1][2] = -ml->expz;
+ G_mb.mainb[a]->bb->vec[1][0] = ml->expx;
+ G_mb.mainb[a]->bb->vec[1][1] = -ml->expy;
+ G_mb.mainb[a]->bb->vec[1][2] = -ml->expz;
/* 2 */
- mainb[a]->bb->vec[2][0] = ml->expx;
- mainb[a]->bb->vec[2][1] = ml->expy;
- mainb[a]->bb->vec[2][2] = -ml->expz;
+ G_mb.mainb[a]->bb->vec[2][0] = ml->expx;
+ G_mb.mainb[a]->bb->vec[2][1] = ml->expy;
+ G_mb.mainb[a]->bb->vec[2][2] = -ml->expz;
/* 3 */
- mainb[a]->bb->vec[3][0] = -ml->expx;
- mainb[a]->bb->vec[3][1] = ml->expy;
- mainb[a]->bb->vec[3][2] = -ml->expz;
+ G_mb.mainb[a]->bb->vec[3][0] = -ml->expx;
+ G_mb.mainb[a]->bb->vec[3][1] = ml->expy;
+ G_mb.mainb[a]->bb->vec[3][2] = -ml->expz;
/* 4 */
- mainb[a]->bb->vec[4][0] = -ml->expx;
- mainb[a]->bb->vec[4][1] = -ml->expy;
- mainb[a]->bb->vec[4][2] = ml->expz;
+ G_mb.mainb[a]->bb->vec[4][0] = -ml->expx;
+ G_mb.mainb[a]->bb->vec[4][1] = -ml->expy;
+ G_mb.mainb[a]->bb->vec[4][2] = ml->expz;
/* 5 */
- mainb[a]->bb->vec[5][0] = ml->expx;
- mainb[a]->bb->vec[5][1] = -ml->expy;
- mainb[a]->bb->vec[5][2] = ml->expz;
+ G_mb.mainb[a]->bb->vec[5][0] = ml->expx;
+ G_mb.mainb[a]->bb->vec[5][1] = -ml->expy;
+ G_mb.mainb[a]->bb->vec[5][2] = ml->expz;
/* 6 */
- mainb[a]->bb->vec[6][0] = ml->expx;
- mainb[a]->bb->vec[6][1] = ml->expy;
- mainb[a]->bb->vec[6][2] = ml->expz;
+ G_mb.mainb[a]->bb->vec[6][0] = ml->expx;
+ G_mb.mainb[a]->bb->vec[6][1] = ml->expy;
+ G_mb.mainb[a]->bb->vec[6][2] = ml->expz;
/* 7 */
- mainb[a]->bb->vec[7][0] = -ml->expx;
- mainb[a]->bb->vec[7][1] = ml->expy;
- mainb[a]->bb->vec[7][2] = ml->expz;
+ G_mb.mainb[a]->bb->vec[7][0] = -ml->expx;
+ G_mb.mainb[a]->bb->vec[7][1] = ml->expy;
+ G_mb.mainb[a]->bb->vec[7][2] = ml->expz;
/* transformation of Metalem bb */
for (i = 0; i < 8; i++)
- mul_m4_v3((float (*)[4])mat, mainb[a]->bb->vec[i]);
+ mul_m4_v3((float (*)[4])mat, G_mb.mainb[a]->bb->vec[i]);
/* find max and min of transformed bb */
for (i = 0; i < 8; i++) {
/* find maximums */
- if (mainb[a]->bb->vec[i][0] > max_x) max_x = mainb[a]->bb->vec[i][0];
- if (mainb[a]->bb->vec[i][1] > max_y) max_y = mainb[a]->bb->vec[i][1];
- if (mainb[a]->bb->vec[i][2] > max_z) max_z = mainb[a]->bb->vec[i][2];
+ if (G_mb.mainb[a]->bb->vec[i][0] > max_x) max_x = G_mb.mainb[a]->bb->vec[i][0];
+ if (G_mb.mainb[a]->bb->vec[i][1] > max_y) max_y = G_mb.mainb[a]->bb->vec[i][1];
+ if (G_mb.mainb[a]->bb->vec[i][2] > max_z) max_z = G_mb.mainb[a]->bb->vec[i][2];
/* find minimums */
- if (mainb[a]->bb->vec[i][0] < min_x) min_x = mainb[a]->bb->vec[i][0];
- if (mainb[a]->bb->vec[i][1] < min_y) min_y = mainb[a]->bb->vec[i][1];
- if (mainb[a]->bb->vec[i][2] < min_z) min_z = mainb[a]->bb->vec[i][2];
+ if (G_mb.mainb[a]->bb->vec[i][0] < min_x) min_x = G_mb.mainb[a]->bb->vec[i][0];
+ if (G_mb.mainb[a]->bb->vec[i][1] < min_y) min_y = G_mb.mainb[a]->bb->vec[i][1];
+ if (G_mb.mainb[a]->bb->vec[i][2] < min_z) min_z = G_mb.mainb[a]->bb->vec[i][2];
}
/* create "new" bb, only point 0 and 6, which are
* necessary for octal tree filling */
- mainb[a]->bb->vec[0][0] = min_x - ml->rad;
- mainb[a]->bb->vec[0][1] = min_y - ml->rad;
- mainb[a]->bb->vec[0][2] = min_z - ml->rad;
+ G_mb.mainb[a]->bb->vec[0][0] = min_x - ml->rad;
+ G_mb.mainb[a]->bb->vec[0][1] = min_y - ml->rad;
+ G_mb.mainb[a]->bb->vec[0][2] = min_z - ml->rad;
- mainb[a]->bb->vec[6][0] = max_x + ml->rad;
- mainb[a]->bb->vec[6][1] = max_y + ml->rad;
- mainb[a]->bb->vec[6][2] = max_z + ml->rad;
+ G_mb.mainb[a]->bb->vec[6][0] = max_x + ml->rad;
+ G_mb.mainb[a]->bb->vec[6][1] = max_y + ml->rad;
+ G_mb.mainb[a]->bb->vec[6][2] = max_z + ml->rad;
a++;
}
@@ -1832,13 +1838,13 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
/* totsize (= 'manhattan' radius) */
totsize = 0.0;
- for (a = 0; a < totelem; a++) {
+ for (a = 0; a < G_mb.totelem; a++) {
- vec[0] = mainb[a]->x + mainb[a]->rad + mainb[a]->expx;
- vec[1] = mainb[a]->y + mainb[a]->rad + mainb[a]->expy;
- vec[2] = mainb[a]->z + mainb[a]->rad + mainb[a]->expz;
+ vec[0] = G_mb.mainb[a]->x + G_mb.mainb[a]->rad + G_mb.mainb[a]->expx;
+ vec[1] = G_mb.mainb[a]->y + G_mb.mainb[a]->rad + G_mb.mainb[a]->expy;
+ vec[2] = G_mb.mainb[a]->z + G_mb.mainb[a]->rad + G_mb.mainb[a]->expz;
- calc_mballco(mainb[a], vec);
+ calc_mballco(G_mb.mainb[a], vec);
size = fabsf(vec[0]);
if (size > totsize) totsize = size;
@@ -1847,11 +1853,11 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
size = fabsf(vec[2]);
if (size > totsize) totsize = size;
- vec[0] = mainb[a]->x - mainb[a]->rad;
- vec[1] = mainb[a]->y - mainb[a]->rad;
- vec[2] = mainb[a]->z - mainb[a]->rad;
+ vec[0] = G_mb.mainb[a]->x - G_mb.mainb[a]->rad;
+ vec[1] = G_mb.mainb[a]->y - G_mb.mainb[a]->rad;
+ vec[2] = G_mb.mainb[a]->z - G_mb.mainb[a]->rad;
- calc_mballco(mainb[a], vec);
+ calc_mballco(G_mb.mainb[a], vec);
size = fabsf(vec[0]);
if (size > totsize) totsize = size;
@@ -1861,8 +1867,8 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
if (size > totsize) totsize = size;
}
- for (a = 0; a < totelem; a++) {
- thresh += densfunc(mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
+ for (a = 0; a < G_mb.totelem; a++) {
+ G_mb.thresh += densfunc(G_mb.mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
}
return totsize;
@@ -2178,13 +2184,13 @@ static void init_metaball_octal_tree(int depth)
float size[3];
int a;
- metaball_tree = MEM_mallocN(sizeof(octal_tree), "metaball_octal_tree");
- metaball_tree->first = node = MEM_mallocN(sizeof(octal_node), "metaball_octal_node");
+ G_mb.metaball_tree = MEM_mallocN(sizeof(octal_tree), "metaball_octal_tree");
+ G_mb.metaball_tree->first = node = MEM_mallocN(sizeof(octal_node), "metaball_octal_node");
/* maximal depth of octree */
- metaball_tree->depth = depth;
+ G_mb.metaball_tree->depth = depth;
- metaball_tree->neg = node->neg = 0;
- metaball_tree->pos = node->pos = 0;
+ G_mb.metaball_tree->neg = node->neg = 0;
+ G_mb.metaball_tree->pos = node->pos = 0;
node->elems.first = NULL;
node->elems.last = NULL;
@@ -2197,26 +2203,26 @@ static void init_metaball_octal_tree(int depth)
node->x_max = node->y_max = node->z_max = -FLT_MAX;
/* size of octal tree scene */
- for (a = 0; a < totelem; a++) {
- if (mainb[a]->bb->vec[0][0] < node->x_min) node->x_min = mainb[a]->bb->vec[0][0];
- if (mainb[a]->bb->vec[0][1] < node->y_min) node->y_min = mainb[a]->bb->vec[0][1];
- if (mainb[a]->bb->vec[0][2] < node->z_min) node->z_min = mainb[a]->bb->vec[0][2];
+ for (a = 0; a < G_mb.totelem; a++) {
+ if (G_mb.mainb[a]->bb->vec[0][0] < node->x_min) node->x_min = G_mb.mainb[a]->bb->vec[0][0];
+ if (G_mb.mainb[a]->bb->vec[0][1] < node->y_min) node->y_min = G_mb.mainb[a]->bb->vec[0][1];
+ if (G_mb.mainb[a]->bb->vec[0][2] < node->z_min) node->z_min = G_mb.mainb[a]->bb->vec[0][2];
- if (mainb[a]->bb->vec[6][0] > node->x_max) node->x_max = mainb[a]->bb->vec[6][0];
- if (mainb[a]->bb->vec[6][1] > node->y_max) node->y_max = mainb[a]->bb->vec[6][1];
- if (mainb[a]->bb->vec[6][2] > node->z_max) node->z_max = mainb[a]->bb->vec[6][2];
+ if (G_mb.mainb[a]->bb->vec[6][0] > node->x_max) node->x_max = G_mb.mainb[a]->bb->vec[6][0];
+ if (G_mb.mainb[a]->bb->vec[6][1] > node->y_max) node->y_max = G_mb.mainb[a]->bb->vec[6][1];
+ if (G_mb.mainb[a]->bb->vec[6][2] > node->z_max) node->z_max = G_mb.mainb[a]->bb->vec[6][2];
ml_p = MEM_mallocN(sizeof(ml_pointer), "ml_pointer");
- ml_p->ml = mainb[a];
+ ml_p->ml = G_mb.mainb[a];
BLI_addtail(&node->elems, ml_p);
- if ((mainb[a]->flag & MB_NEGATIVE) == 0) {
+ if ((G_mb.mainb[a]->flag & MB_NEGATIVE) == 0) {
/* number of positive MetaElem in scene */
- metaball_tree->pos++;
+ G_mb.metaball_tree->pos++;
}
else {
/* number of negative MetaElem in scene */
- metaball_tree->neg++;
+ G_mb.metaball_tree->neg++;
}
}
@@ -2226,7 +2232,7 @@ static void init_metaball_octal_tree(int depth)
size[2] = node->z_max - node->z_min;
/* first node is subdivided recursively */
- subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth);
+ subdivide_metaball_octal_node(node, size[0], size[1], size[2], G_mb.metaball_tree->depth);
}
void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
@@ -2239,48 +2245,48 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
mb = ob->data;
- if (totelem == 0) return;
+ if (G_mb.totelem == 0) return;
if ((G.is_rendering == FALSE) && (mb->flag == MB_UPDATE_NEVER)) return;
if (G.moving && mb->flag == MB_UPDATE_FAST) return;
curindex = totindex = 0;
indices = NULL;
- thresh = mb->thresh;
+ G_mb.thresh = mb->thresh;
/* total number of MetaElems (totelem) is precomputed in find_basis_mball() function */
- mainb = MEM_mallocN(sizeof(void *) * totelem, "mainb");
+ G_mb.mainb = MEM_mallocN(sizeof(void *) * G_mb.totelem, "mainb");
/* initialize all mainb (MetaElems) */
totsize = init_meta(scene, ob);
- if (metaball_tree) {
- free_metaball_octal_node(metaball_tree->first);
- MEM_freeN(metaball_tree);
- metaball_tree = NULL;
+ if (G_mb.metaball_tree) {
+ free_metaball_octal_node(G_mb.metaball_tree->first);
+ MEM_freeN(G_mb.metaball_tree);
+ G_mb.metaball_tree = NULL;
}
/* if scene includes more then one MetaElem, then octal tree optimization is used */
- if ((totelem > 1) && (totelem <= 64)) init_metaball_octal_tree(1);
- if ((totelem > 64) && (totelem <= 128)) init_metaball_octal_tree(2);
- if ((totelem > 128) && (totelem <= 512)) init_metaball_octal_tree(3);
- if ((totelem > 512) && (totelem <= 1024)) init_metaball_octal_tree(4);
- if (totelem > 1024) init_metaball_octal_tree(5);
+ if ((G_mb.totelem > 1) && (G_mb.totelem <= 64)) init_metaball_octal_tree(1);
+ if ((G_mb.totelem > 64) && (G_mb.totelem <= 128)) init_metaball_octal_tree(2);
+ if ((G_mb.totelem > 128) && (G_mb.totelem <= 512)) init_metaball_octal_tree(3);
+ if ((G_mb.totelem > 512) && (G_mb.totelem <= 1024)) init_metaball_octal_tree(4);
+ if (G_mb.totelem > 1024) init_metaball_octal_tree(5);
/* don't polygonize metaballs with too high resolution (base mball to small)
* note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
- if (metaball_tree) {
- if (ob->size[0] <= 0.00001f * (metaball_tree->first->x_max - metaball_tree->first->x_min) ||
- ob->size[1] <= 0.00001f * (metaball_tree->first->y_max - metaball_tree->first->y_min) ||
- ob->size[2] <= 0.00001f * (metaball_tree->first->z_max - metaball_tree->first->z_min))
+ if (G_mb.metaball_tree) {
+ if (ob->size[0] <= 0.00001f * (G_mb.metaball_tree->first->x_max - G_mb.metaball_tree->first->x_min) ||
+ ob->size[1] <= 0.00001f * (G_mb.metaball_tree->first->y_max - G_mb.metaball_tree->first->y_min) ||
+ ob->size[2] <= 0.00001f * (G_mb.metaball_tree->first->z_max - G_mb.metaball_tree->first->z_min))
{
new_pgn_element(-1); /* free values created by init_meta */
- MEM_freeN(mainb);
+ MEM_freeN(G_mb.mainb);
/* free tree */
- free_metaball_octal_node(metaball_tree->first);
- MEM_freeN(metaball_tree);
- metaball_tree = NULL;
+ free_metaball_octal_node(G_mb.metaball_tree->first);
+ MEM_freeN(G_mb.metaball_tree);
+ G_mb.metaball_tree = NULL;
return;
}
@@ -2304,13 +2310,13 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
polygonize(&mbproc, mb);
- MEM_freeN(mainb);
+ MEM_freeN(G_mb.mainb);
/* free octal tree */
- if (totelem > 1) {
- free_metaball_octal_node(metaball_tree->first);
- MEM_freeN(metaball_tree);
- metaball_tree = NULL;
+ if (G_mb.totelem > 1) {
+ free_metaball_octal_node(G_mb.metaball_tree->first);
+ MEM_freeN(G_mb.metaball_tree);
+ G_mb.metaball_tree = NULL;
}
if (curindex) {
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 4c23a370a5d..268234c7e73 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -69,7 +69,6 @@
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
-#include "BKE_utildefines.h"
#include "BKE_movieclip.h"
#include "BKE_image.h" /* openanim */
#include "BKE_tracking.h"
@@ -1002,6 +1001,14 @@ void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, in
IMB_freeImBuf(ibuf);
}
}
+void BKE_movieclip_get_size_fl(MovieClip *clip, MovieClipUser *user, float size[2])
+{
+ int width, height;
+ BKE_movieclip_get_size(clip, user, &width, &height);
+
+ size[0] = (float)width;
+ size[1] = (float)height;
+}
int BKE_movieclip_get_duration(MovieClip *clip)
{
@@ -1012,9 +1019,9 @@ int BKE_movieclip_get_duration(MovieClip *clip)
return clip->len;
}
-void BKE_movieclip_aspect(MovieClip *clip, float *aspx, float *aspy)
+void BKE_movieclip_get_aspect(MovieClip *clip, float *aspx, float *aspy)
{
- *aspx = *aspy = 1.0;
+ *aspx = 1.0;
/* x is always 1 */
*aspy = clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c283db94103..ade418e409f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -58,8 +58,6 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
-#include "BKE_utildefines.h"
-#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -2265,6 +2263,7 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_tex_gradient(ttype);
register_node_type_sh_tex_magic(ttype);
register_node_type_sh_tex_checker(ttype);
+ register_node_type_sh_tex_brick(ttype);
}
static void registerTextureNodes(bNodeTreeType *ttype)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 5bb0e0929ff..f8f2ae86f1d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2710,7 +2710,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID) == 0) {
scene->physics_settings.quick_cache_step =
scene->physics_settings.quick_cache_step ?
- MIN2(scene->physics_settings.quick_cache_step, pid->cache->step) :
+ mini(scene->physics_settings.quick_cache_step, pid->cache->step) :
pid->cache->step;
}
}
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
new file mode 100644
index 00000000000..7f9578250f2
--- /dev/null
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -0,0 +1,156 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/object_deform.c
+ * \ingroup bke
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "BKE_action.h"
+#include "BKE_object_deform.h" /* own include */
+#include "BKE_object.h"
+#include "BKE_modifier.h"
+
+#include "DNA_armature_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_object_types.h"
+
+/* --- functions for getting vgroup aligned maps --- */
+
+/**
+ * gets the status of "flag" for each bDeformGroup
+ * in ob->defbase and returns an array containing them
+ */
+char *BKE_objdef_lock_flags_get(Object *ob, const int defbase_tot)
+{
+ char is_locked = FALSE;
+ int i;
+ //int defbase_tot = BLI_countlist(&ob->defbase);
+ char *lock_flags = MEM_mallocN(defbase_tot * sizeof(char), "defflags");
+ bDeformGroup *defgroup;
+
+ for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+ lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
+ is_locked |= lock_flags[i];
+ }
+ if (is_locked) {
+ return lock_flags;
+ }
+
+ MEM_freeN(lock_flags);
+ return NULL;
+}
+
+char *BKE_objdef_validmap_get(Object *ob, const int defbase_tot)
+{
+ bDeformGroup *dg;
+ ModifierData *md;
+ char *vgroup_validmap;
+ GHash *gh;
+ int i, step1 = 1;
+ //int defbase_tot = BLI_countlist(&ob->defbase);
+
+ if (ob->defbase.first == NULL) {
+ return NULL;
+ }
+
+ gh = BLI_ghash_str_new("BKE_objdef_validmap_get gh");
+
+ /* add all names to a hash table */
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
+ BLI_ghash_insert(gh, dg->name, NULL);
+ }
+
+ BLI_assert(BLI_ghash_size(gh) == defbase_tot);
+
+ /* now loop through the armature modifiers and identify deform bones */
+ for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
+ if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))
+ continue;
+
+ if (md->type == eModifierType_Armature) {
+ ArmatureModifierData *amd = (ArmatureModifierData *) md;
+
+ if (amd->object && amd->object->pose) {
+ bPose *pose = amd->object->pose;
+ bPoseChannel *chan;
+
+ for (chan = pose->chanbase.first; chan; chan = chan->next) {
+ if (chan->bone->flag & BONE_NO_DEFORM)
+ continue;
+
+ if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {
+ BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));
+ }
+ }
+ }
+ }
+ }
+
+ vgroup_validmap = MEM_mallocN(defbase_tot, "wpaint valid map");
+
+ /* add all names to a hash table */
+ for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
+ vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
+ }
+
+ BLI_assert(i == BLI_ghash_size(gh));
+
+ BLI_ghash_free(gh, NULL, NULL);
+
+ return vgroup_validmap;
+}
+
+/* Returns total selected vgroups,
+ * wpi.defbase_sel is assumed malloc'd, all values are set */
+char *BKE_objdef_selected_get(Object *ob, int defbase_tot, int *r_dg_flags_sel_tot)
+{
+ char *dg_selection = MEM_mallocN(defbase_tot * sizeof(char), __func__);
+ bDeformGroup *defgroup;
+ unsigned int i;
+ Object *armob = BKE_object_pose_armature_get(ob);
+ (*r_dg_flags_sel_tot) = 0;
+
+ if (armob) {
+ bPose *pose = armob->pose;
+ for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(pose, defgroup->name);
+ if (pchan && (pchan->bone->flag & BONE_SELECTED)) {
+ dg_selection[i] = TRUE;
+ (*r_dg_flags_sel_tot) += 1;
+ }
+ else {
+ dg_selection[i] = FALSE;
+ }
+ }
+ }
+ else {
+ memset(dg_selection, FALSE, sizeof(char) * defbase_tot);
+ }
+
+ return dg_selection;
+}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 66b0cff691e..b862a824d50 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -37,8 +37,6 @@
#include "BKE_image.h"
#include "BKE_ocean.h"
-#include "BKE_utildefines.h"
-
#include "BKE_global.h" // XXX TESTING
#include "BLI_math_base.h"
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 9787a5025f7..03342d0f6d1 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -57,7 +57,6 @@
#include "BKE_packedFile.h"
#include "BKE_report.h"
#include "BKE_sound.h"
-#include "BKE_utildefines.h"
#ifdef _WIN32
#define open _open
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index e990f461d4c..780528f4a0d 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -69,7 +69,6 @@
#include "BKE_scene.h"
#include "BKE_smoke.h"
#include "BKE_softbody.h"
-#include "BKE_utildefines.h"
#include "BIK_api.h"
@@ -1030,7 +1029,8 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
ListBase *lb_dupli_ob;
- if ((lb_dupli_ob=object_duplilist(scene, ob))) {
+ /* don't update the dupli groups, we only wan't their pid's */
+ if ((lb_dupli_ob = object_duplilist_ex(scene, ob, FALSE))) {
DupliObject *dob;
for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
if (dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
@@ -1067,8 +1067,9 @@ static int ptcache_path(PTCacheID *pid, char *filename)
if (pid->cache->flag & PTCACHE_EXTERNAL) {
strcpy(filename, pid->cache->path);
- if (strncmp(filename, "//", 2)==0)
+ if (BLI_path_is_rel(filename)) {
BLI_path_abs(filename, blendfilename);
+ }
return BLI_add_slash(filename); /* new strlen() */
}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index c440d21f56d..7d9d2f02c06 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -44,7 +44,6 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
-#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_library.h"
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index d137393e698..4dbe0b6290c 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -49,7 +49,6 @@
#include "BKE_main.h"
#include "BKE_sequencer.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 70f27db0f74..6028b40756d 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -43,7 +43,6 @@
#include "BKE_colortools.h"
#include "BKE_sequencer.h"
-#include "BKE_utildefines.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -155,14 +154,11 @@ void colorBalance_init_data(SequenceModifierData *smd)
}
}
-ImBuf *colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
- ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
- BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf_new, cbmd->color_multiply, FALSE, mask);
-
- return ibuf_new;
+ BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf, cbmd->color_multiply, FALSE, mask);
}
static SequenceModifierTypeInfo seqModifier_ColorBalance = {
@@ -253,10 +249,9 @@ void curves_apply_threaded(int width, int height, unsigned char *rect, float *re
}
}
-ImBuf *curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
CurvesModifierData *cmd = (CurvesModifierData *) smd;
- ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
float black[3] = {0.0f, 0.0f, 0.0f};
float white[3] = {1.0f, 1.0f, 1.0f};
@@ -266,11 +261,9 @@ ImBuf *curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
curvemapping_premultiply(&cmd->curve_mapping, 0);
curvemapping_set_black_white(&cmd->curve_mapping, black, white);
- modifier_apply_threaded(ibuf_new, mask, curves_apply_threaded, &cmd->curve_mapping);
+ modifier_apply_threaded(ibuf, mask, curves_apply_threaded, &cmd->curve_mapping);
curvemapping_premultiply(&cmd->curve_mapping, 1);
-
- return ibuf_new;
}
static SequenceModifierTypeInfo seqModifier_Curves = {
@@ -372,16 +365,13 @@ void hue_correct_apply_threaded(int width, int height, unsigned char *rect, floa
}
}
-ImBuf *hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
- ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
curvemapping_initialize(&hcmd->curve_mapping);
- modifier_apply_threaded(ibuf_new, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
-
- return ibuf_new;
+ modifier_apply_threaded(ibuf, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
}
static SequenceModifierTypeInfo seqModifier_HueCorrect = {
@@ -470,18 +460,15 @@ void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, f
}
}
-ImBuf *brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
BrightContrastThreadData data;
- ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
data.bright = bcmd->bright;
data.contrast = bcmd->contrast;
- modifier_apply_threaded(ibuf_new, mask, brightcontrast_apply_threaded, &data);
-
- return ibuf_new;
+ modifier_apply_threaded(ibuf, mask, brightcontrast_apply_threaded, &data);
}
static SequenceModifierTypeInfo seqModifier_BrightContrast = {
@@ -596,7 +583,6 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
for (smd = seq->modifiers.first; smd; smd = smd->next) {
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
- ImBuf *ibuf_new;
/* could happen if modifier is being removed or not exists in current version of blender */
if (!smti)
@@ -612,12 +598,7 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
if (processed_ibuf == ibuf)
processed_ibuf = IMB_dupImBuf(ibuf);
- ibuf_new = smti->apply(smd, processed_ibuf, mask);
-
- if (ibuf_new != processed_ibuf) {
- IMB_freeImBuf(processed_ibuf);
- processed_ibuf = ibuf_new;
- }
+ smti->apply(smd, processed_ibuf, mask);
if (mask)
IMB_freeImBuf(mask);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 8aab622148b..2596bf57f05 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -62,7 +62,6 @@
#include "BKE_fcurve.h"
#include "BKE_scene.h"
#include "BKE_mask.h"
-#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -166,14 +165,12 @@ static void seq_free_strip(Strip *strip)
if (strip->transform) {
MEM_freeN(strip->transform);
}
- if (strip->color_balance) {
- MEM_freeN(strip->color_balance);
- }
MEM_freeN(strip);
}
-void BKE_sequence_free(Scene *scene, Sequence *seq)
+/* only give option to skip cache locally (static func) */
+static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const int do_cache)
{
if (seq->strip)
seq_free_strip(seq->strip);
@@ -209,21 +206,37 @@ void BKE_sequence_free(Scene *scene, Sequence *seq)
/* free cached data used by this strip,
* also invalidate cache for all dependent sequences
+ *
+ * be _very_ careful here, invalidating cache loops over the scene sequences and
+ * assumes the listbase is valid for all strips, this may not be the case if lists are being freed.
+ * this is optional BKE_sequence_invalidate_cache
*/
- BKE_sequence_invalidate_cache(scene, seq);
+ if (do_cache) {
+ if (scene) {
+ BKE_sequence_invalidate_cache(scene, seq);
+ }
+ }
MEM_freeN(seq);
}
+void BKE_sequence_free(Scene *scene, Sequence *seq)
+{
+ BKE_sequence_free_ex(scene, seq, TRUE);
+}
+
+/* cache must be freed before calling this function
+ * since it leaves the seqbase in an invalid state */
static void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
{
- Sequence *iseq;
+ Sequence *iseq, *iseq_next;
- for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
+ for (iseq = seq->seqbase.first; iseq; iseq = iseq_next) {
+ iseq_next = iseq->next;
seq_free_sequence_recurse(scene, iseq);
}
- BKE_sequence_free(scene, seq);
+ BKE_sequence_free_ex(scene, seq, FALSE);
}
@@ -244,7 +257,7 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent)
seq_free_clipboard_recursive(seq);
}
- BKE_sequence_free(NULL, seq_parent);
+ BKE_sequence_free_ex(NULL, seq_parent, FALSE);
}
void BKE_sequencer_free_clipboard(void)
@@ -273,22 +286,22 @@ Editing *BKE_sequencer_editing_ensure(Scene *scene)
void BKE_sequencer_editing_free(Scene *scene)
{
Editing *ed = scene->ed;
- MetaStack *ms;
Sequence *seq;
if (ed == NULL)
return;
+ /* this may not be the active scene!, could be smarter about this */
+ BKE_sequencer_cache_cleanup();
+
SEQ_BEGIN (ed, seq)
{
- BKE_sequence_free(scene, seq);
+ /* handle cache freeing above */
+ BKE_sequence_free_ex(scene, seq, FALSE);
}
SEQ_END
- while ((ms = ed->metastack.first)) {
- BLI_remlink(&ed->metastack, ms);
- MEM_freeN(ms);
- }
+ BLI_freelistN(&ed->metastack);
MEM_freeN(ed);
@@ -1671,26 +1684,6 @@ void BKE_sequencer_color_balance_apply(StripColorBalance *cb, ImBuf *ibuf, float
imb_freerectImBuf(ibuf);
}
-static void sequence_color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
-{
- StripColorBalance *cb = seq->strip->color_balance;
- ImBuf *mask_input = NULL;
- short make_float = seq->flag & SEQ_MAKE_FLOAT;
-
- if (seq->mask_sequence) {
- if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
- int make_float = ibuf->rect_float != NULL;
-
- mask_input = BKE_sequencer_render_mask_input(context, SEQUENCE_MASK_INPUT_STRIP, seq->mask_sequence, NULL, cfra, make_float);
- }
- }
-
- BKE_sequencer_color_balance_apply(cb, ibuf, mul, make_float, mask_input);
-
- if (mask_input)
- IMB_freeImBuf(mask_input);
-}
-
/*
* input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE
*
@@ -1713,9 +1706,7 @@ int BKE_sequencer_input_have_to_preprocess(SeqRenderData UNUSED(context), Sequen
{
float mul;
- if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
- SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL))
- {
+ if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL)) {
return TRUE;
}
@@ -1834,11 +1825,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
mul *= seq->blend_opacity / 100.0f;
}
- if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
- sequence_color_balance(context, seq, ibuf, mul, cfra);
- mul = 1.0;
- }
-
if (seq->flag & SEQ_MAKE_FLOAT) {
if (!ibuf->rect_float)
IMB_float_from_rect_simple(ibuf);
@@ -2171,7 +2157,7 @@ static ImBuf *seq_render_mask(SeqRenderData context, Mask *mask, float nr, short
BKE_maskrasterize_handle_init(mr_handle, mask_temp, context.rectx, context.recty, TRUE, TRUE, TRUE);
- BKE_mask_free(mask_temp);
+ BKE_mask_free_nolib(mask_temp);
MEM_freeN(mask_temp);
BKE_maskrasterize_buffer(mr_handle, context.rectx, context.recty, maskbuf);
@@ -2962,13 +2948,18 @@ int BKE_sequence_check_depend(Sequence *seq, Sequence *cur)
return TRUE;
}
-static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_preprocess)
+static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_self, int invalidate_preprocess)
{
Editing *ed = scene->ed;
Sequence *cur;
/* invalidate cache for current sequence */
- BKE_sequencer_cache_cleanup_sequence(seq);
+ if (invalidate_self)
+ BKE_sequencer_cache_cleanup_sequence(seq);
+
+ /* if invalidation is invoked from sequence free routine, effectdata would be NULL here */
+ if (seq->effectdata && seq->type == SEQ_TYPE_SPEED)
+ BKE_sequence_effect_speed_rebuild_map(scene, seq, TRUE);
if (invalidate_preprocess)
BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
@@ -2989,54 +2980,40 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat
void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
{
- sequence_invalidate_cache(scene, seq, TRUE);
+ sequence_invalidate_cache(scene, seq, TRUE, TRUE);
+}
+
+void BKE_sequence_invalidate_deendent(Scene *scene, Sequence *seq)
+{
+ sequence_invalidate_cache(scene, seq, FALSE, TRUE);
}
void BKE_sequence_invalidate_cache_for_modifier(Scene *scene, Sequence *seq)
{
- sequence_invalidate_cache(scene, seq, FALSE);
+ sequence_invalidate_cache(scene, seq, TRUE, FALSE);
}
-void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
+void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int for_render)
{
Sequence *seq;
- if (check_mem_usage) {
- /* Let the cache limitor take care of this (schlaile) */
- /* While render let's keep all memory available for render
- * (ton)
- * At least if free memory is tight...
- * This can make a big difference in encoding speed
- * (it is around 4 times(!) faster, if we do not waste time
- * on freeing _all_ buffers every time on long timelines...)
- * (schlaile)
- */
-
- uintptr_t mem_in_use;
- uintptr_t mmap_in_use;
- uintptr_t max;
-
- mem_in_use = MEM_get_memory_in_use();
- mmap_in_use = MEM_get_mapped_memory_in_use();
- max = MEM_CacheLimiter_get_maximum();
-
- if (max == 0 || mem_in_use + mmap_in_use <= max) {
- return;
- }
- }
-
BKE_sequencer_cache_cleanup();
-
+
for (seq = seqbase->first; seq; seq = seq->next) {
+ if (for_render && CFRA >= seq->startdisp && CFRA <= seq->enddisp) {
+ continue;
+ }
+
if (seq->strip) {
- if (seq->type == SEQ_TYPE_MOVIE && !keep_file_handles)
+ if (seq->type == SEQ_TYPE_MOVIE) {
free_anim_seq(seq);
+ }
if (seq->type == SEQ_TYPE_SPEED) {
BKE_sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
if (seq->type == SEQ_TYPE_META) {
- BKE_sequencer_free_imbuf(scene, &seq->seqbase, FALSE, keep_file_handles);
+ BKE_sequencer_free_imbuf(scene, &seq->seqbase, for_render);
}
if (seq->type == SEQ_TYPE_SCENE) {
/* FIXME: recurs downwards,
@@ -4038,10 +4015,6 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
seqn->strip->proxy->anim = NULL;
}
- if (seq->strip->color_balance) {
- seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
- }
-
if (seqn->modifiers.first) {
seqn->modifiers.first = seqn->modifiers.last = NULL;
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index f9399946570..9a8bcaabe0c 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -313,7 +313,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
auxMesh = object_get_derived_final(calc->smd->auxTarget);
if (!auxMesh)
return;
- space_transform_setup(&local2aux, calc->ob, calc->smd->auxTarget);
+ SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget);
}
//After sucessufuly build the trees, start projection vertexs
@@ -500,7 +500,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
//TODO there might be several "bugs" on non-uniform scales matrixs
//because it will no longer be nearest surface, not sphere projection
//because space has been deformed
- space_transform_setup(&calc.local2target, ob, smd->target);
+ SPACE_TRANSFORM_SETUP(&calc.local2target, ob, smd->target);
//TODO: smd->keepDist is in global units.. must change to local
calc.keepDist = smd->keepDist;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 008dc332710..4a88bfbfdad 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2291,7 +2291,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* done goal stuff */
/* gravitation */
- if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+ if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
float gravity[3];
copy_v3_v3(gravity, scene->physics_settings.gravity);
mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob, bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 2462de07a18..f340bcb5b1e 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -50,7 +50,6 @@
# include "AUD_C-API.h"
#endif
-#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_sound.h"
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 7de5f97588b..787def5c20b 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1684,7 +1684,8 @@ void txt_print_undo(Text *text)
printf("%c%c%c", text->undo_buf[i], text->undo_buf[i + 1], text->undo_buf[i + 2]);
i += 3;
break;
- case UNDO_INSERT_4: case UNDO_BS_4: case UNDO_DEL_4: {
+ case UNDO_INSERT_4: case UNDO_BS_4: case UNDO_DEL_4:
+ {
unsigned int uc;
char c[BLI_UTF8_MAX + 1];
size_t c_len;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 2f54fe6cebd..ee904de4af6 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -56,7 +56,6 @@
#include "IMB_imbuf.h"
-#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_ocean.h"
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 78e7dab045f..2ed9d992c3f 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -411,6 +411,8 @@ void BKE_tracking_clipboard_free(void)
track = next_track;
}
+
+ tracking_clipboard.tracks.first = tracking_clipboard.tracks.last = NULL;
}
void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingObject *object)
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index dd71e43182e..434bfe19c1f 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -51,14 +51,14 @@
#include "BKE_node.h"
#include "BKE_world.h"
-void BKE_world_free(World *wrld)
+void BKE_world_free_ex(World *wrld, int do_id_user)
{
MTex *mtex;
int a;
for (a = 0; a < MAX_MTEX; a++) {
mtex = wrld->mtex[a];
- if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--;
if (mtex) MEM_freeN(mtex);
}
BKE_previewimg_free(&wrld->preview);
@@ -67,7 +67,7 @@ void BKE_world_free(World *wrld)
/* is no lib link block, but world extension */
if (wrld->nodetree) {
- ntreeFreeTree(wrld->nodetree);
+ ntreeFreeTree_ex(wrld->nodetree, do_id_user);
MEM_freeN(wrld->nodetree);
}
@@ -75,6 +75,10 @@ void BKE_world_free(World *wrld)
wrld->id.icon_id = 0;
}
+void BKE_world_free(World *wrld)
+{
+ BKE_world_free_ex(wrld, TRUE);
+}
World *add_world(const char *name)
{
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 3526058e12b..bd25ff8c6e6 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -177,58 +177,71 @@ static AVFrame *alloc_picture(int pix_fmt, int width, int height)
static const char **get_file_extensions(int format)
{
switch (format) {
- case FFMPEG_DV: {
+ case FFMPEG_DV:
+ {
static const char *rv[] = { ".dv", NULL };
return rv;
}
- case FFMPEG_MPEG1: {
+ case FFMPEG_MPEG1:
+ {
static const char *rv[] = { ".mpg", ".mpeg", NULL };
return rv;
}
- case FFMPEG_MPEG2: {
+ case FFMPEG_MPEG2:
+ {
static const char *rv[] = { ".dvd", ".vob", ".mpg", ".mpeg", NULL };
return rv;
}
- case FFMPEG_MPEG4: {
+ case FFMPEG_MPEG4:
+ {
static const char *rv[] = { ".mp4", ".mpg", ".mpeg", NULL };
return rv;
}
- case FFMPEG_AVI: {
+ case FFMPEG_AVI:
+ {
static const char *rv[] = { ".avi", NULL };
return rv;
}
- case FFMPEG_MOV: {
+ case FFMPEG_MOV:
+ {
static const char *rv[] = { ".mov", NULL };
return rv;
}
- case FFMPEG_H264: {
+ case FFMPEG_H264:
+ {
/* FIXME: avi for now... */
static const char *rv[] = { ".avi", NULL };
return rv;
}
- case FFMPEG_XVID: {
+ case FFMPEG_XVID:
+ {
/* FIXME: avi for now... */
static const char *rv[] = { ".avi", NULL };
return rv;
}
- case FFMPEG_FLV: {
+ case FFMPEG_FLV:
+ {
static const char *rv[] = { ".flv", NULL };
return rv;
}
- case FFMPEG_MKV: {
+ case FFMPEG_MKV:
+ {
static const char *rv[] = { ".mkv", NULL };
return rv;
}
- case FFMPEG_OGG: {
+ case FFMPEG_OGG:
+ {
static const char *rv[] = { ".ogg", ".ogv", NULL };
return rv;
}
- case FFMPEG_MP3: {
+ case FFMPEG_MP3:
+ {
static const char *rv[] = { ".mp3", NULL };
return rv;
}
- case FFMPEG_WAV: {
+ case FFMPEG_WAV:
+ {
static const char *rv[] = { ".wav", NULL };
return rv;
}
@@ -946,6 +959,7 @@ int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty,
}
void BKE_ffmpeg_end(void);
+static void end_ffmpeg_impl(int is_autosplit);
#ifdef WITH_AUDASPACE
static void write_audio_frames(double to_pts)
@@ -978,7 +992,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
if (ffmpeg_autosplit) {
if (avio_tell(outfile->pb) > FFMPEG_AUTOSPLIT_SIZE) {
- BKE_ffmpeg_end();
+ end_ffmpeg_impl(TRUE);
ffmpeg_autosplit_count++;
success &= start_ffmpeg_impl(rd, rectx, recty, reports);
}
@@ -991,7 +1005,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
return success;
}
-void BKE_ffmpeg_end(void)
+static void end_ffmpeg_impl(int is_autosplit)
{
unsigned int i;
@@ -1004,9 +1018,11 @@ void BKE_ffmpeg_end(void)
#endif
#ifdef WITH_AUDASPACE
- if (audio_mixdown_device) {
- AUD_closeReadDevice(audio_mixdown_device);
- audio_mixdown_device = 0;
+ if (is_autosplit == FALSE) {
+ if (audio_mixdown_device) {
+ AUD_closeReadDevice(audio_mixdown_device);
+ audio_mixdown_device = 0;
+ }
}
#endif
@@ -1069,6 +1085,11 @@ void BKE_ffmpeg_end(void)
}
}
+void BKE_ffmpeg_end(void)
+{
+ end_ffmpeg_impl(FALSE);
+}
+
/* properties */
void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_)