diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-30 06:03:40 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-30 06:03:40 +0400 |
commit | 65668dc5eb45ae6e90675aecc9dd6132dc7f0b5e (patch) | |
tree | 355f3b4dd6f28dc0debf249d1c85a6474784dcfe /source/blender/blenkernel | |
parent | 16702c172939a399ddd0e61fc14a8b0944c4249b (diff) | |
parent | 15bd96efeb77cf33215613a53059f01db7242b31 (diff) |
Merged changes in the trunk up to revision 41368.
Conflicts resolved:
source/blender/blenkernel/intern/library.c
source/blender/blenlib/intern/bpath.c
source/blender/render/intern/source/convertblender.c
Diffstat (limited to 'source/blender/blenkernel')
172 files changed, 766 insertions, 961 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 2c3ffc296ba..5e403849289 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 7d3de68c005..67efb7752ea 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index da389c6f1d0..44aebdf6205 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index cf49c479fe3..cba6b0ef257 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index a0660490baf..8836999bc9b 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_array_mallocn.h b/source/blender/blenkernel/BKE_array_mallocn.h index 42c4c2ebdd0..45ca4a5e694 100644 --- a/source/blender/blenkernel/BKE_array_mallocn.h +++ b/source/blender/blenkernel/BKE_array_mallocn.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -25,7 +23,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -*/ + */ #ifndef BKE_ARRAY_MALLOCN_H #define BKE_ARRAY_MALLOCN_H diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index f5684810e14..71771b6077d 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 5c28fa88503..9739a5eacf2 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bmeshCustomData.h b/source/blender/blenkernel/BKE_bmeshCustomData.h index aabfcfaa0f6..2c6449eb290 100644 --- a/source/blender/blenkernel/BKE_bmeshCustomData.h +++ b/source/blender/blenkernel/BKE_bmeshCustomData.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bmfont.h b/source/blender/blenkernel/BKE_bmfont.h index ef7323fc4c3..5f23121b802 100644 --- a/source/blender/blenkernel/BKE_bmfont.h +++ b/source/blender/blenkernel/BKE_bmfont.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bmfont_types.h b/source/blender/blenkernel/BKE_bmfont_types.h index 658302e9f1d..a4d37069cab 100644 --- a/source/blender/blenkernel/BKE_bmfont_types.h +++ b/source/blender/blenkernel/BKE_bmfont_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_boids.h b/source/blender/blenkernel/BKE_boids.h index 36ca0cde87d..18e8be1512e 100644 --- a/source/blender/blenkernel/BKE_boids.h +++ b/source/blender/blenkernel/BKE_boids.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_booleanops_mesh.h b/source/blender/blenkernel/BKE_booleanops_mesh.h index aecd3385662..7c989ea17e6 100644 --- a/source/blender/blenkernel/BKE_booleanops_mesh.h +++ b/source/blender/blenkernel/BKE_booleanops_mesh.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index ebb9714cd1b..32418384795 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h index 2756ded3a08..5eb653f69d1 100644 --- a/source/blender/blenkernel/BKE_bullet.h +++ b/source/blender/blenkernel/BKE_bullet.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index b497698f660..c3f5ae7fbf0 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index 07158f5f3fa..c71c86e110d 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index a5c88000db2..2dfe9fd3402 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index 4048ee2f457..acb3ae03816 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 758789683d5..fd3a3fea2bb 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 7254536b555..3f9edf41e3c 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 02fc70e41e8..9282f0ef29a 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 4eb8e5a8d96..f3922f43cbc 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h index 030d46fc1a6..f32a4b1e6a8 100644 --- a/source/blender/blenkernel/BKE_customdata_file.h +++ b/source/blender/blenkernel/BKE_customdata_file.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 64cea929573..84a6517fd52 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -46,7 +44,7 @@ void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2); struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup); struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name); int defgroup_find_index(struct Object *ob, struct bDeformGroup *dg); -int *defgroup_flip_map(struct Object *ob, int use_default); +int *defgroup_flip_map(struct Object *ob, int *flip_map_len, int use_default); int defgroup_flip_index(struct Object *ob, int index, int use_default); int defgroup_name_index(struct Object *ob, const char *name); void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob); @@ -59,9 +57,9 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index void defvert_copy(struct MDeformVert *dvert_r, const struct MDeformVert *dvert); void defvert_sync(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, int use_verify); -void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, int use_verify); +void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, const int flip_map_len, int use_verify); void defvert_remap (struct MDeformVert *dvert, int *map); -void defvert_flip(struct MDeformVert *dvert, const int *flip_map); +void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); void defvert_normalize(struct MDeformVert *dvert); /* utility function, note that 32 chars is the maximum string length since its only diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index f36073ba841..59b7712a5a4 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 1eed0aaca00..2d863201767 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -1,5 +1,4 @@ /* - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 12f9383cefb..59a361c010d 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 08798a6ddf0..27e9140ba77 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -215,10 +213,12 @@ struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, short *replace); /* get the time extents for F-Curve */ -void calc_fcurve_range(struct FCurve *fcu, float *min, float *max, const short selOnly); +void calc_fcurve_range(struct FCurve *fcu, float *min, float *max, + const short do_sel_only, const short do_min_length); /* get the bounding-box extents for F-Curve */ -void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly); +void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, + const short do_sel_only); /* .............. */ diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h index f6070cd81f0..a68009dda37 100644 --- a/source/blender/blenkernel/BKE_fluidsim.h +++ b/source/blender/blenkernel/BKE_fluidsim.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 214ae03b453..e164294b9a2 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index a59d43d315d..bc9134b40b8 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 4898bb28c8d..dbb1107c228 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index e497f43e46d..554314c419a 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 9f7d4aeb0d3..ee18a41dbfe 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h index e46ad450c31..57855a7082f 100644 --- a/source/blender/blenkernel/BKE_idcode.h +++ b/source/blender/blenkernel/BKE_idcode.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 2ba23d4a944..10c02f54b2e 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 8181ad6421c..adb34f4c501 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -60,10 +58,12 @@ int BKE_ftype_to_imtype(int ftype); int BKE_imtype_to_ftype(int imtype); int BKE_imtype_is_movie(int imtype); -struct anim *openanim(char * name, int flags, int streamindex); +struct anim *openanim(const char *name, int flags, int streamindex); void image_de_interlace(struct Image *ima, int odd); - + +void make_local_image(struct Image *ima); + void tag_image_time(struct Image *ima); void free_old_images(void); diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index ea98c226e67..d21b0597976 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index c29320ef13c..c055bb2004b 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 2936338e760..57c05637d50 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 0d6d41109b4..e2033915caa 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -52,6 +50,7 @@ void *copy_libblock(void *rt); void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action); void id_lib_extern(struct ID *id); +void BKE_library_filepath_set(struct Library *lib, const char *filepath); void id_us_plus(struct ID *id); void id_us_min(struct ID *id); int id_make_local(struct ID *id, int test); @@ -60,6 +59,7 @@ int id_copy(struct ID *id, struct ID **newid, int test); int id_unlink(struct ID *id, int test); int new_id(struct ListBase *lb, struct ID *id, const char *name); +void id_clear_lib_data(struct Main *bmain, struct ID *id); struct ListBase *which_libbase(struct Main *mainlib, short type); @@ -78,7 +78,7 @@ void rename_id(struct ID *id, const char *name); void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); -void all_local(struct Library *lib, int untagged_only); +void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only); struct ID *find_id(const char *type, const char *name); void clear_id_newpoins(void); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index feef14b00c7..e31d4edbc74 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 0e0348e78e9..8e7645d721e 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index c4119e99780..3dde54fd811 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 347263bb290..07c6fb8b09c 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 28950e4b2eb..a47cefe6f65 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index ba23b2d79c0..4f1262cd523 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h index 1880e1e6728..ab5c2b19707 100644 --- a/source/blender/blenkernel/BKE_navmesh_conversion.h +++ b/source/blender/blenkernel/BKE_navmesh_conversion.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 49c1f8acd24..773c5ced1cb 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index b75a8cb29ec..a819a464d3f 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index b1943fdf97c..393568c6b60 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index f1c7356e6b0..606d6167937 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 89733f1623c..e14db31607a 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index c417b1efe4f..c4284d2cf0a 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_plugin_types.h b/source/blender/blenkernel/BKE_plugin_types.h index a7842b526ce..73c6dae35cf 100644 --- a/source/blender/blenkernel/BKE_plugin_types.h +++ b/source/blender/blenkernel/BKE_plugin_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index fcfa6ccf9f4..110e6e851c8 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h index 10014a4611d..ce0ea3dcc9a 100644 --- a/source/blender/blenkernel/BKE_property.h +++ b/source/blender/blenkernel/BKE_property.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h index 253f3ea9ac1..784f8a63757 100644 --- a/source/blender/blenkernel/BKE_report.h +++ b/source/blender/blenkernel/BKE_report.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_sca.h b/source/blender/blenkernel/BKE_sca.h index 0db0b71c102..cfcc0e146d8 100644 --- a/source/blender/blenkernel/BKE_sca.h +++ b/source/blender/blenkernel/BKE_sca.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 943712167c6..5c214b2892a 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index bc443b4a3a6..5b6d7e3cd96 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_script.h b/source/blender/blenkernel/BKE_script.h index 304e46fe2c5..d8ceaf23652 100644 --- a/source/blender/blenkernel/BKE_script.h +++ b/source/blender/blenkernel/BKE_script.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 9cb4dfae534..e64de965db5 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -217,9 +215,7 @@ typedef enum { SEQ_STRIPELEM_IBUF_ENDSTILL } seq_stripelem_ibuf_t; -void seq_stripelem_cache_init(void); void seq_stripelem_cache_destruct(void); - void seq_stripelem_cache_cleanup(void); /* returned ImBuf is properly refed and has to be freed */ diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index 9deb71a3474..d1fef8b0ce1 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index 087cabc5c3d..1dd82c1d8e6 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h index 16e5336bcc1..51acef44f52 100644 --- a/source/blender/blenkernel/BKE_smoke.h +++ b/source/blender/blenkernel/BKE_smoke.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index 6aea9344070..c889aa83b9a 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 3728dd41089..57746f3a68f 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h index 111bd86fdd3..d309c048f1a 100644 --- a/source/blender/blenkernel/BKE_speaker.h +++ b/source/blender/blenkernel/BKE_speaker.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index 30142c12601..dcbd045f62d 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h index c684271cbbf..a0a270422c7 100644 --- a/source/blender/blenkernel/BKE_suggestions.h +++ b/source/blender/blenkernel/BKE_suggestions.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index bf80b033fbd..2a613522686 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 9fb93f60fd5..de72428b3d7 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 269941597b0..1f54e4eeef0 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index f65b937a54b..3222167c56e 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -1,5 +1,4 @@ /* - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -25,7 +24,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -*/ + */ /** \file BKE_utildefines.h * \ingroup bke diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 6c8d1ba7945..fe25279dcfb 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h index 19cc1ae2dbf..f2502cf25f7 100644 --- a/source/blender/blenkernel/BKE_writeavi.h +++ b/source/blender/blenkernel/BKE_writeavi.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h index 8345f0f5d2e..2b10f1b246c 100644 --- a/source/blender/blenkernel/BKE_writeffmpeg.h +++ b/source/blender/blenkernel/BKE_writeffmpeg.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h index 8b2022076bb..2117a23b938 100644 --- a/source/blender/blenkernel/BKE_writeframeserver.h +++ b/source/blender/blenkernel/BKE_writeframeserver.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index a2747f49264..2f6579d855f 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or @@ -24,11 +23,6 @@ # # ***** END GPL LICENSE BLOCK ***** -if(WITH_CODEC_FFMPEG) - # FFMPEG gives warnigns which are hard to avoid across multiple versions. - remove_strict_flags() -endif() - set(INC . ../avi @@ -308,6 +302,10 @@ if(WITH_CODEC_FFMPEG) ${FFMPEG_INCLUDE_DIRS} ) add_definitions(-DWITH_FFMPEG) + + remove_strict_flags_file( + intern/writeffmpeg.c + ) endif() if(WITH_PYTHON) diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h index ef4f320602b..2dd14281253 100644 --- a/source/blender/blenkernel/depsgraph_private.h +++ b/source/blender/blenkernel/depsgraph_private.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index 512866a6d87..8a6426eb3d5 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -3,7 +3,6 @@ * * Custom Data functions for Bmesh * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index cd0af6d58f0..bc87c5dbb6a 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -3,7 +3,6 @@ * * BMesh mesh level functions. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c index bbd439dcb93..25970dd8d91 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -3,7 +3,6 @@ * * BMesh Euler construction API. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index e34f2ee1e50..1b5761fb94e 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -3,7 +3,6 @@ * * BMesh mesh level functions. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index c385ad4fcda..6d8a8339e46 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -3,7 +3,6 @@ * * Low level routines for manipulating the BMesh structure. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index a95d149f058..d1c258cbc93 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -3,7 +3,6 @@ * * Functions for changing the topology of a mesh. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bf9acb224d5..4793e83df53 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -1,4 +1,3 @@ -/* $Id$ */ /** \file blender/blenkernel/intern/CCGSubSurf.c * \ingroup bke diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index 1835e63727d..457ad2af353 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -1,4 +1,3 @@ -/* $Id$ */ /** \file blender/blenkernel/intern/CCGSubSurf.h * \ingroup bke diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 06d7838c2bc..3ea7296e883 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 8b9f5ac98d3..2a1794fe2fc 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -45,6 +43,7 @@ #include "DNA_object_types.h" #include "BLI_blenlib.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" @@ -96,8 +95,8 @@ typedef struct tMakeLocalActionContext { bAction *act; /* original action */ bAction *actn; /* new action */ - int lib; /* some action users were libraries */ - int local; /* some action users were not libraries */ + int is_lib; /* some action users were libraries */ + int is_local; /* some action users were not libraries */ } tMakeLocalActionContext; /* helper function for make_local_action() - local/lib init step */ @@ -106,10 +105,8 @@ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr) tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr; if (adt->action == mlac->act) { - if (id->lib) - mlac->lib = 1; - else - mlac->local = 1; + if (id->lib) mlac->is_lib= TRUE; + else mlac->is_local= TRUE; } } @@ -131,7 +128,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr) // does copy_fcurve... void make_local_action(bAction *act) { - tMakeLocalActionContext mlac = {act, NULL, 0, 0}; + tMakeLocalActionContext mlac = {act, NULL, FALSE, FALSE}; Main *bmain= G.main; if (act->id.lib==NULL) @@ -139,24 +136,24 @@ void make_local_action(bAction *act) // XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default if ((act->id.flag & LIB_FAKEUSER) && (act->id.us<=1)) { - act->id.lib= NULL; - act->id.flag= LIB_LOCAL; - new_id(&bmain->action, (ID *)act, NULL); + id_clear_lib_data(bmain, &act->id); return; } BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac); - if (mlac.local && mlac.lib==0) { - act->id.lib= NULL; - act->id.flag= LIB_LOCAL; - //make_local_action_channels(act); - new_id(&bmain->action, (ID *)act, NULL); + if (mlac.is_local && mlac.is_lib==FALSE) { + id_clear_lib_data(bmain, &act->id); } - else if (mlac.local && mlac.lib) { + else if (mlac.is_local && mlac.is_lib) { + char *bpath_user_data[2]= {bmain->name, act->id.lib->filepath}; + mlac.actn= copy_action(act); mlac.actn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &mlac.actn->id, bpath_relocate_visitor, 0, bpath_user_data); + BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac); } } @@ -650,12 +647,12 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan { bConstraint *pcon, *con; - VECCOPY(pchan->loc, chan->loc); - VECCOPY(pchan->size, chan->size); - VECCOPY(pchan->eul, chan->eul); - VECCOPY(pchan->rotAxis, chan->rotAxis); + copy_v3_v3(pchan->loc, chan->loc); + copy_v3_v3(pchan->size, chan->size); + copy_v3_v3(pchan->eul, chan->eul); + copy_v3_v3(pchan->rotAxis, chan->rotAxis); pchan->rotAngle= chan->rotAngle; - QUATCOPY(pchan->quat, chan->quat); + copy_qt_qt(pchan->quat, chan->quat); pchan->rotmode= chan->rotmode; copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat); copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat); @@ -684,9 +681,9 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_ /* ik (dof) settings */ pchan->ikflag = pchan_from->ikflag; - VECCOPY(pchan->limitmin, pchan_from->limitmin); - VECCOPY(pchan->limitmax, pchan_from->limitmax); - VECCOPY(pchan->stiffness, pchan_from->stiffness); + copy_v3_v3(pchan->limitmin, pchan_from->limitmin); + copy_v3_v3(pchan->limitmax, pchan_from->limitmax); + copy_v3_v3(pchan->stiffness, pchan_from->stiffness); pchan->ikstretch= pchan_from->ikstretch; pchan->ikrotweight= pchan_from->ikrotweight; pchan->iklinweight= pchan_from->iklinweight; @@ -883,7 +880,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ /* get extents for this curve */ // TODO: allow enabling/disabling this? - calc_fcurve_range(fcu, &nmin, &nmax, FALSE); + calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE); /* compare to the running tally */ min= MIN2(min, nmin); @@ -1121,13 +1118,13 @@ void copy_pose_result(bPose *to, bPose *from) copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat); /* used for local constraints */ - VECCOPY(pchanto->loc, pchanfrom->loc); - QUATCOPY(pchanto->quat, pchanfrom->quat); - VECCOPY(pchanto->eul, pchanfrom->eul); - VECCOPY(pchanto->size, pchanfrom->size); + copy_v3_v3(pchanto->loc, pchanfrom->loc); + copy_qt_qt(pchanto->quat, pchanfrom->quat); + copy_v3_v3(pchanto->eul, pchanfrom->eul); + copy_v3_v3(pchanto->size, pchanfrom->size); - VECCOPY(pchanto->pose_head, pchanfrom->pose_head); - VECCOPY(pchanto->pose_tail, pchanfrom->pose_tail); + copy_v3_v3(pchanto->pose_head, pchanfrom->pose_head); + copy_v3_v3(pchanto->pose_tail, pchanfrom->pose_tail); pchanto->rotmode= pchanfrom->rotmode; pchanto->flag= pchanfrom->flag; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index da6dd5bd39d..2ef13318af4 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -365,10 +363,10 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) if (mpt->pchan) { /* heads or tails */ if (mpath->flag & MOTIONPATH_FLAG_BHEAD) { - VECCOPY(mpv->co, mpt->pchan->pose_head); + copy_v3_v3(mpv->co, mpt->pchan->pose_head); } else { - VECCOPY(mpv->co, mpt->pchan->pose_tail); + copy_v3_v3(mpv->co, mpt->pchan->pose_tail); } /* result must be in worldspace */ @@ -376,7 +374,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) } else { /* worldspace object location */ - VECCOPY(mpv->co, mpt->ob->obmat[3]); + copy_v3_v3(mpv->co, mpt->ob->obmat[3]); } } } @@ -656,15 +654,15 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, totfac= data[0]+data[3]; if(totfac>FLT_EPSILON) interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac); - else QUATCOPY(q1, p1->quat); + else copy_qt_qt(q1, p1->quat); totfac= data[1]+data[2]; if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac); - else QUATCOPY(q2, p3->quat); + else copy_qt_qt(q2, p3->quat); totfac = data[0]+data[1]+data[2]+data[3]; if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac); - else QUATCOPY(quat, q2); + else copy_qt_qt(quat, q2); } if(radius) @@ -844,7 +842,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n add_v3_v3(vec, vdd->obmat[3]); copy_m4_m4(obmat, vdd->obmat); - VECCOPY(obmat[3], vec); + copy_v3_v3(obmat[3], vec); if(vdd->par->transflag & OB_DUPLIROT) { if(no_f) { @@ -869,7 +867,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n vdd->ob->lay = origlay; if(vdd->orco) - VECCOPY(dob->orco, vdd->orco[index]); + copy_v3_v3(dob->orco, vdd->orco[index]); if(vdd->ob->transflag & OB_DUPLI) { float tmpmat[4][4]; @@ -1121,7 +1119,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa copy_m4_m4(obmat, ob__obmat); - VECCOPY(obmat[3], cent); + copy_v3_v3(obmat[3], cent); /* rotation */ tri_to_quat( quat,v1, v2, v3); @@ -1380,7 +1378,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p psys_get_dupli_path_transform(&sim, NULL, cpa, cache, pamat, &scale); } - VECCOPY(pamat[3], cache->co); + copy_v3_v3(pamat[3], cache->co); pamat[3][3]= 1.0f; } @@ -1428,7 +1426,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p /* to give ipos in object correct offset */ where_is_object_time(scene, ob, ctime-pa_time); - VECCOPY(vec, obmat[3]); + copy_v3_v3(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */ @@ -1548,7 +1546,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i mul_m4_v3(pmat, vec); copy_m4_m4(obmat, par->obmat); - VECCOPY(obmat[3], vec); + copy_v3_v3(obmat[3], vec); new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 8ed255e688c..632e5126574 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index fbbce58414e..9fba18dd7cf 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -39,6 +37,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -138,33 +137,33 @@ void free_armature(bArmature *arm) void make_local_armature(bArmature *arm) { Main *bmain= G.main; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; Object *ob; if (arm->id.lib==NULL) return; if (arm->id.us==1) { - arm->id.lib= NULL; - arm->id.flag= LIB_LOCAL; - new_id(&bmain->armature, (ID*)arm, NULL); + id_clear_lib_data(bmain, &arm->id); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(ob->data == arm) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - arm->id.lib= NULL; - arm->id.flag= LIB_LOCAL; - new_id(&bmain->armature, (ID *)arm, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &arm->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, arm->id.lib->filepath}; bArmature *armn= copy_armature(arm); armn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &armn->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data == arm) { if(ob->id.lib==NULL) { @@ -391,11 +390,11 @@ static void equalize_bezier(float *data, int desired) pdist[0]= 0.0f; for(a=0, fp= data; a<MAX_BBONE_SUBDIV; a++, fp+=4) { - QUATCOPY(temp[a], fp); + copy_qt_qt(temp[a], fp); pdist[a+1]= pdist[a]+len_v3v3(fp, fp+4); } /* do last point */ - QUATCOPY(temp[a], fp); + copy_qt_qt(temp[a], fp); totdist= pdist[a]; /* go over distances and calculate new points */ @@ -421,7 +420,7 @@ static void equalize_bezier(float *data, int desired) fp[3]= fac1*temp[nr-1][3]+ fac2*temp[nr][3]; } /* set last point, needed for orientation calculus */ - QUATCOPY(fp, temp[MAX_BBONE_SUBDIV]); + copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]); } /* returns pointer to static array, filled with desired amount of bone->segments elements */ @@ -489,9 +488,9 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest) /* transform previous point inside this bone space */ if(rest) - VECCOPY(h1, prev->bone->arm_head) + copy_v3_v3(h1, prev->bone->arm_head); else - VECCOPY(h1, prev->pose_head) + copy_v3_v3(h1, prev->pose_head); mul_m4_v3(imat, h1); if(prev->bone->segments>1) { @@ -528,9 +527,9 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest) /* transform next point inside this bone space */ if(rest) - VECCOPY(h2, next->bone->arm_tail) + copy_v3_v3(h2, next->bone->arm_tail); else - VECCOPY(h2, next->pose_tail) + copy_v3_v3(h2, next->pose_tail); mul_m4_v3(imat, h2); /* if next bone is B-bone too, use average handle direction */ if(next->bone->segments>1); @@ -576,7 +575,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest) vec_roll_to_mat3(h1, fp[3], mat3); // fp[3] is roll copy_m4_m3(result_array[a].mat, mat3); - VECCOPY(result_array[a].mat[3], fp); + copy_v3_v3(result_array[a].mat[3], fp); if(doscale) { /* correct for scaling when this matrix is used in scaled space */ @@ -738,7 +737,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f if(bone==NULL) return 0.0f; - VECCOPY (cop, co); + copy_v3_v3(cop, co); fac= distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist); @@ -783,7 +782,7 @@ static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f if (!weight) return; - VECCOPY(cop, co); + copy_v3_v3(cop, co); if(vec) { if(pchan->bone->segments>1) @@ -1020,7 +1019,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, normalize_dq(dq, contrib); if(armature_weight != 1.0f) { - VECCOPY(dco, co); + copy_v3_v3(dco, co); mul_v3m3_dq( dco, (defMats)? summat: NULL,dq); sub_v3_v3(dco, co); mul_v3_fl(dco, armature_weight); @@ -1116,11 +1115,11 @@ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc) float nLocMat[4][4]; /* build matrix for location */ - VECCOPY(xLocMat[3], inloc); + copy_v3_v3(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ armature_mat_world_to_pose(ob, xLocMat, nLocMat); - VECCOPY(outloc, nLocMat[3]); + copy_v3_v3(outloc, nLocMat[3]); } /* Convert Pose-Space Matrix to Bone-Space Matrix @@ -1195,11 +1194,11 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) float nLocMat[4][4]; /* build matrix for location */ - VECCOPY(xLocMat[3], inloc); + copy_v3_v3(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ armature_mat_pose_to_bone(pchan, xLocMat, nLocMat); - VECCOPY(outloc, nLocMat[3]); + copy_v3_v3(outloc, nLocMat[3]); } /* same as object_mat3_to_rot() */ @@ -1404,7 +1403,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone) copy_m4_m3(offs_bone, bone->bone_mat); /* The bone's root offset (is in the parent's coordinate system) */ - VECCOPY(offs_bone[3], bone->head); + copy_v3_v3(offs_bone[3], bone->head); /* Get the length translation of parent (length along y axis) */ offs_bone[3][1]+= prevbone->length; @@ -1414,7 +1413,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone) } else { copy_m4_m3(bone->arm_mat, bone->bone_mat); - VECCOPY(bone->arm_mat[3], bone->head); + copy_v3_v3(bone->arm_mat[3], bone->head); } /* and the kiddies */ @@ -1850,8 +1849,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* firstly, calculate the bone matrix the standard way, since this is needed for roll control */ where_is_pose_bone(scene, ob, pchan, ctime, 1); - VECCOPY(poseHead, pchan->pose_head); - VECCOPY(poseTail, pchan->pose_tail); + copy_v3_v3(poseHead, pchan->pose_head); + copy_v3_v3(poseTail, pchan->pose_tail); /* step 1: determine the positions for the endpoints of the bone */ { @@ -1895,7 +1894,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* store the position, and convert it to pose space */ mul_m4_v3(ob->imat, vec); - VECCOPY(poseHead, vec); + copy_v3_v3(poseHead, vec); /* set the new radius (it should be the average value) */ radius = (radius+rad) / 2; @@ -1919,9 +1918,9 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* compute the raw rotation matrix from the bone's current matrix by extracting only the * orientation-relevant axes, and normalising them */ - VECCOPY(rmat[0], pchan->pose_mat[0]); - VECCOPY(rmat[1], pchan->pose_mat[1]); - VECCOPY(rmat[2], pchan->pose_mat[2]); + copy_v3_v3(rmat[0], pchan->pose_mat[0]); + copy_v3_v3(rmat[1], pchan->pose_mat[1]); + copy_v3_v3(rmat[2], pchan->pose_mat[2]); normalize_m3(rmat); /* also, normalise the orientation imposed by the bone, now that we've extracted the scale factor */ @@ -2012,7 +2011,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* when the 'no-root' option is affected, the chain can retain * the shape but be moved elsewhere */ - VECCOPY(poseHead, pchan->pose_head); + copy_v3_v3(poseHead, pchan->pose_head); } else if (tree->con->enforce < 1.0f) { /* when the influence is too low @@ -2020,18 +2019,18 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o * - stick to the parent for any other */ if (pchan->parent) { - VECCOPY(poseHead, pchan->pose_head); + copy_v3_v3(poseHead, pchan->pose_head); } else { // FIXME: this introduces popping artifacts when we reach 0.0 interp_v3_v3v3(poseHead, pchan->pose_head, poseHead, tree->con->enforce); } } - VECCOPY(poseMat[3], poseHead); + copy_v3_v3(poseMat[3], poseHead); /* finally, store the new transform */ copy_m4_m4(pchan->pose_mat, poseMat); - VECCOPY(pchan->pose_head, poseHead); + copy_v3_v3(pchan->pose_head, poseHead); /* recalculate tail, as it's now outdated after the head gets adjusted above! */ where_is_pose_bone_tail(pchan); @@ -2110,7 +2109,7 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4]) /* prevent action channels breaking chains */ /* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */ if ((pchan->bone==NULL) || !(pchan->bone->flag & BONE_CONNECTED)) { - VECCOPY(chan_mat[3], pchan->loc); + copy_v3_v3(chan_mat[3], pchan->loc); } } @@ -2196,11 +2195,11 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha ofs = amod->turbul / 200.0f; /* make a copy of starting conditions */ - VECCOPY(loc, pchan->pose_mat[3]); + copy_v3_v3(loc, pchan->pose_mat[3]); mat4_to_eul( eul,pchan->pose_mat); mat4_to_size( size,pchan->pose_mat); - VECCOPY(eulo, eul); - VECCOPY(sizeo, size); + copy_v3_v3(eulo, eul); + copy_v3_v3(sizeo, size); /* apply noise to each set of channels */ if (amod->channels & 4) { @@ -2251,7 +2250,7 @@ void where_is_pose_bone_tail(bPoseChannel *pchan) { float vec[3]; - VECCOPY(vec, pchan->pose_mat[1]); + copy_v3_v3(vec, pchan->pose_mat[1]); mul_v3_fl(vec, pchan->bone->length); add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec); } @@ -2285,7 +2284,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti copy_m4_m3(offs_bone, bone->bone_mat); /* The bone's root offset (is in the parent's coordinate system) */ - VECCOPY(offs_bone[3], bone->head); + copy_v3_v3(offs_bone[3], bone->head); /* Get the length translation of parent (length along y axis) */ offs_bone[3][1]+= parbone->length; @@ -2363,7 +2362,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti bConstraintOb *cob; /* make a copy of location of PoseChannel for later */ - VECCOPY(vec, pchan->pose_mat[3]); + copy_v3_v3(vec, pchan->pose_mat[3]); /* prepare PoseChannel for Constraint solving * - makes a copy of matrix, and creates temporary struct to use @@ -2380,13 +2379,13 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti /* prevent constraints breaking a chain */ if(pchan->bone->flag & BONE_CONNECTED) { - VECCOPY(pchan->pose_mat[3], vec); + copy_v3_v3(pchan->pose_mat[3], vec); } } } /* calculate head */ - VECCOPY(pchan->pose_head, pchan->pose_mat[3]); + copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]); /* calculate tail */ where_is_pose_bone_tail(pchan); } @@ -2417,8 +2416,8 @@ void where_is_pose (Scene *scene, Object *ob) bone= pchan->bone; if(bone) { copy_m4_m4(pchan->pose_mat, bone->arm_mat); - VECCOPY(pchan->pose_head, bone->arm_head); - VECCOPY(pchan->pose_tail, bone->arm_tail); + copy_v3_v3(pchan->pose_head, bone->arm_head); + copy_v3_v3(pchan->pose_tail, bone->arm_tail); } } } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index b2bcd9aa6aa..6e343e874f1 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -63,6 +61,7 @@ #include "BLI_callbacks.h" #include "IMB_imbuf.h" +#include "IMB_moviecache.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -113,6 +112,7 @@ void free_blender(void) BLI_cb_finalize(); seq_stripelem_cache_destruct(); + IMB_moviecache_destruct(); free_nodesystem(); } @@ -160,22 +160,19 @@ static void clear_global(void) G.main= NULL; } +static int clean_paths_visit_cb(void *UNUSED(userdata), char *path_dst, const char *path_src) +{ + strcpy(path_dst, path_src); + BLI_clean(path_dst); + return (strcmp(path_dst, path_src) == 0) ? FALSE : TRUE; +} + /* make sure path names are correct for OS */ static void clean_paths(Main *main) { - struct BPathIterator *bpi; - char filepath_expanded[1024]; Scene *scene; - for(BLI_bpathIterator_init(&bpi, main, main->name, BPATH_USE_PACKED); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) { - BLI_bpathIterator_getPath(bpi, filepath_expanded); - - BLI_clean(filepath_expanded); - - BLI_bpathIterator_setPath(bpi, filepath_expanded); - } - - BLI_bpathIterator_free(bpi); + bpath_traverse_main(main, clean_paths_visit_cb, 0, NULL); for(scene= main->scene.first; scene; scene= scene->id.next) { BLI_clean(scene->r.pic); diff --git a/source/blender/blenkernel/intern/bmesh_private.h b/source/blender/blenkernel/intern/bmesh_private.h index d2b1d9fd566..b114f38cdd5 100644 --- a/source/blender/blenkernel/intern/bmesh_private.h +++ b/source/blender/blenkernel/intern/bmesh_private.h @@ -3,7 +3,6 @@ * * low level, 'private' function prototypes for bmesh kernel. * - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index d73d7509644..f1e6de9a0c4 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 2a478d4ffe2..3ae81c70d4f 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c index 4e8a3b33827..8dbf2c1c828 100644 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ b/source/blender/blenkernel/intern/booleanops_mesh.c @@ -1,7 +1,6 @@ #if 0 /* - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 4ab9d085de3..10f056e9b78 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -47,6 +45,7 @@ #include "RNA_access.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_rand.h" @@ -183,6 +182,7 @@ void free_brush(Brush *brush) static void extern_local_brush(Brush *brush) { id_lib_extern((ID *)brush->mtex.tex); + id_lib_extern((ID *)brush->clone.image); } void make_local_brush(Brush *brush) @@ -195,29 +195,26 @@ void make_local_brush(Brush *brush) Main *bmain= G.main; Scene *scene; - int local= 0, lib= 0; + int is_local= FALSE, is_lib= FALSE; if(brush->id.lib==NULL) return; if(brush->clone.image) { - /* special case: ima always local immediately */ - brush->clone.image->id.lib= NULL; - brush->clone.image->id.flag= LIB_LOCAL; - new_id(&bmain->brush, (ID *)brush->clone.image, NULL); + /* special case: ima always local immediately. Clone image should only + have one user anyway. */ + id_clear_lib_data(bmain, &brush->clone.image->id); extern_local_brush(brush); } - for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) { + for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) { if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) { - if(scene->id.lib) lib= 1; - else local= 1; + if(scene->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - brush->id.lib= NULL; - brush->id.flag= LIB_LOCAL; - new_id(&bmain->brush, (ID *)brush, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &brush->id); extern_local_brush(brush); /* enable fake user by default */ @@ -226,10 +223,14 @@ void make_local_brush(Brush *brush) brush->id.us++; } } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, brush->id.lib->filepath}; Brush *brushn= copy_brush(brush); brushn->id.us= 1; /* only keep fake user */ brushn->id.flag |= LIB_FAKEUSER; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &brushn->id, bpath_relocate_visitor, 0, bpath_user_data); for(scene= bmain->scene.first; scene; scene=scene->id.next) { if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) { diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index e4a02434cba..9fcb4389c62 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 79229c49b4d..ee160a13fa2 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 0022710e580..dcbb3c43073 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index d30476d44f8..444d17ad004 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 26ee62e035b..09030575438 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 83003809a37..98a434a7d8b 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 8eff86d846e..c244c26ad7f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 2aeb726f623..18c08b617de 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2e9ad11c6ca..13b1da22449 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -38,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_bpath.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -247,7 +246,7 @@ void make_local_curve(Curve *cu) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - when there are only lib users: don't do * - when there are only local users: set flag @@ -257,32 +256,31 @@ void make_local_curve(Curve *cu) if(cu->id.lib==NULL) return; if(cu->id.us==1) { - cu->id.lib= NULL; - cu->id.flag= LIB_LOCAL; - - new_id(&bmain->curve, (ID *)cu, NULL); + id_clear_lib_data(bmain, &cu->id); extern_local_curve(cu); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(ob->data == cu) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - cu->id.lib= NULL; - cu->id.flag= LIB_LOCAL; - - new_id(&bmain->curve, (ID *)cu, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &cu->id); extern_local_curve(cu); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, cu->id.lib->filepath}; Curve *cun= copy_curve(cu); cun->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &cun->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data==cu) { if(ob->id.lib==NULL) { @@ -1231,7 +1229,7 @@ float *make_orco_curve(Scene *scene, Object *ob) fp[1]= 0.0; fp[2]= 0.0; } else { - VECCOPY(fp, &dl->verts[u*3]); + copy_v3_v3(fp, &dl->verts[u*3]); fp[0]= (fp[0]-cu->loc[0])/cu->size[0]; fp[1]= (fp[1]-cu->loc[1])/cu->size[1]; @@ -1260,7 +1258,7 @@ float *make_orco_curve(Scene *scene, Object *ob) int realu= u % dl->parts; vert= dl->verts + 3*(dl->nr*realu + realv); - VECCOPY(fp, vert); + copy_v3_v3(fp, vert); fp[0]= (fp[0]-cu->loc[0])/cu->size[0]; fp[1]= (fp[1]-cu->loc[1])/cu->size[1]; @@ -1521,7 +1519,7 @@ static short bevelinside(BevList *bl1,BevList *bl2) hvec1[0]= bevp->vec[0]; hvec1[1]= bevp->vec[1]; hvec1[2]= 0.0; - VECCOPY(hvec2,hvec1); + copy_v3_v3(hvec2,hvec1); hvec2[0]+=1000; /* test it with all edges of potential surounding poly */ @@ -1692,15 +1690,15 @@ static void bevel_list_cyclic_fix_3D(BevList *bl) bevp= (BevPoint *)(bl+1); bevp1= bevp+1; - QUATCOPY(bevp->quat, bevp1->quat); - VECCOPY(bevp->dir, bevp1->dir); - VECCOPY(bevp->tan, bevp1->tan); + copy_qt_qt(bevp->quat, bevp1->quat); + copy_v3_v3(bevp->dir, bevp1->dir); + copy_v3_v3(bevp->tan, bevp1->tan); bevp= (BevPoint *)(bl+1); bevp+= (bl->nr-1); bevp1= bevp-1; - QUATCOPY(bevp->quat, bevp1->quat); - VECCOPY(bevp->dir, bevp1->dir); - VECCOPY(bevp->tan, bevp1->tan); + copy_qt_qt(bevp->quat, bevp1->quat); + copy_v3_v3(bevp->dir, bevp1->dir); + copy_v3_v3(bevp->tan, bevp1->tan); } /* utility for make_bevel_list_3D_* funcs */ static void bevel_list_calc_bisect(BevList *bl) @@ -1793,7 +1791,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) } - QUATCOPY(bevp0_quat, bevp0->quat); + copy_qt_qt(bevp0_quat, bevp0->quat); while(nr--) { /* interpolate quats */ @@ -1806,7 +1804,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) axis_angle_to_quat(q2, cross, angle_normalized_v3v3(zaxis, bevp1->dir)); normalize_qt(q2); - QUATCOPY(bevp0_quat, bevp1->quat); + copy_qt_qt(bevp0_quat, bevp1->quat); mul_qt_qtqt(q, q2, q); interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5); normalize_qt(bevp1->quat); @@ -1868,7 +1866,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) mul_qt_qtqt(bevp1->quat, q, bevp0->quat); } else { - QUATCOPY(bevp1->quat, bevp0->quat); + copy_qt_qt(bevp1->quat, bevp0->quat); } } @@ -1977,7 +1975,7 @@ static void make_bevel_list_3D_tangent(BevList *bl) bevp1= bevp2+(bl->nr-1); bevp0= bevp1-1; - VECCOPY(bevp0_tan, bevp0->tan); + copy_v3_v3(bevp0_tan, bevp0->tan); nr= bl->nr; while(nr--) { @@ -2037,8 +2035,8 @@ static void make_bevel_list_segment_3D(BevList *bl) axis_angle_to_quat(q, bevp1->dir, bevp1->alfa); mul_qt_qtqt(bevp1->quat, q, bevp1->quat); normalize_qt(bevp1->quat); - VECCOPY(bevp2->dir, bevp1->dir); - QUATCOPY(bevp2->quat, bevp1->quat); + copy_v3_v3(bevp2->dir, bevp1->dir); + copy_qt_qt(bevp2->quat, bevp1->quat); } @@ -2108,7 +2106,7 @@ void makeBevelList(Object *ob) bp= nu->bp; while(len--) { - VECCOPY(bevp->vec, bp->vec); + copy_v3_v3(bevp->vec, bp->vec); bevp->alfa= bp->alfa; bevp->radius= bp->radius; bevp->weight= bp->weight; @@ -2141,7 +2139,7 @@ void makeBevelList(Object *ob) while(a--) { if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) { - VECCOPY(bevp->vec, prevbezt->vec[1]); + copy_v3_v3(bevp->vec, prevbezt->vec[1]); bevp->alfa= prevbezt->alfa; bevp->radius= prevbezt->radius; bevp->weight= prevbezt->weight; @@ -2193,7 +2191,7 @@ void makeBevelList(Object *ob) } if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */ - VECCOPY(bevp->vec, prevbezt->vec[1]); + copy_v3_v3(bevp->vec, prevbezt->vec[1]); bevp->alfa= prevbezt->alfa; bevp->radius= prevbezt->radius; bevp->weight= prevbezt->weight; @@ -3013,15 +3011,15 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] BezTriple *bezt = nu->bezt; for (i=0; i<nu->pntsu; i++,bezt++) { - VECCOPY(co, bezt->vec[0]); co+=3; - VECCOPY(co, bezt->vec[1]); co+=3; - VECCOPY(co, bezt->vec[2]); co+=3; + copy_v3_v3(co, bezt->vec[0]); co+=3; + copy_v3_v3(co, bezt->vec[1]); co+=3; + copy_v3_v3(co, bezt->vec[2]); co+=3; } } else { BPoint *bp = nu->bp; for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) { - VECCOPY(co, bp->vec); co+=3; + copy_v3_v3(co, bp->vec); co+=3; } } } @@ -3040,15 +3038,15 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3] BezTriple *bezt = nu->bezt; for (i=0; i<nu->pntsu; i++,bezt++) { - VECCOPY(bezt->vec[0], co); co+=3; - VECCOPY(bezt->vec[1], co); co+=3; - VECCOPY(bezt->vec[2], co); co+=3; + copy_v3_v3(bezt->vec[0], co); co+=3; + copy_v3_v3(bezt->vec[1], co); co+=3; + copy_v3_v3(bezt->vec[2], co); co+=3; } } else { BPoint *bp = nu->bp; for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) { - VECCOPY(bp->vec, co); co+=3; + copy_v3_v3(bp->vec, co); co+=3; } } } @@ -3066,9 +3064,9 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] BezTriple *bezt = nu->bezt; for (i=0; i<nu->pntsu; i++,bezt++) { - VECCOPY(co, key); co+=3; key+=3; - VECCOPY(co, key); co+=3; key+=3; - VECCOPY(co, key); co+=3; key+=3; + copy_v3_v3(co, key); co+=3; key+=3; + copy_v3_v3(co, key); co+=3; key+=3; + copy_v3_v3(co, key); co+=3; key+=3; key+=3; /* skip tilt */ } } @@ -3076,7 +3074,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] BPoint *bp = nu->bp; for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) { - VECCOPY(co, key); co+=3; key+=3; + copy_v3_v3(co, key); co+=3; key+=3; key++; /* skip tilt */ } } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index d59a9eed363..f2f3ade52bb 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index ab639897866..d65f08ed7a3 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index f18f533d460..a9610023775 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -44,6 +42,7 @@ #include "BKE_deform.h" #include "BLI_blenlib.h" +#include "BLI_utildefines.h" void defgroup_copy_list (ListBase *outbase, ListBase *inbase) @@ -116,18 +115,20 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif } /* be sure all flip_map values are valid */ -void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, int use_verify) +void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify) { - if(dvert->totweight && dvert_r->totweight) { + if (dvert->totweight && dvert_r->totweight) { int i; MDeformWeight *dw; - for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) { - MDeformWeight *dw_r; - if(use_verify) dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]); - else dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]); - - if(dw_r) { - dw_r->weight= dw->weight; + for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) { + if (dw->def_nr < flip_map_len) { + MDeformWeight *dw_r; + if(use_verify) dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]); + else dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]); + + if(dw_r) { + dw_r->weight= dw->weight; + } } } } @@ -165,14 +166,16 @@ void defvert_normalize (MDeformVert *dvert) } } -void defvert_flip (MDeformVert *dvert, const int *flip_map) +void defvert_flip (MDeformVert *dvert, const int *flip_map, const int flip_map_len) { MDeformWeight *dw; int i; - for(dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) - if(flip_map[dw->def_nr] >= 0) + for(dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) { + if((dw->def_nr < flip_map_len) && (flip_map[dw->def_nr] >= 0)) { dw->def_nr= flip_map[dw->def_nr]; + } + } } @@ -252,17 +255,17 @@ int defgroup_find_index (Object *ob, bDeformGroup *dg) } /* note, must be freed */ -int *defgroup_flip_map(Object *ob, int use_default) +int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) { bDeformGroup *dg; - int totdg= BLI_countlist(&ob->defbase); + int totdg= *flip_map_len= BLI_countlist(&ob->defbase); if(totdg==0) { return NULL; } else { char name[sizeof(dg->name)]; - int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), "get_defgroup_flip_map"); + int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), __func__); memset(map, -1, totdg * sizeof(int)); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d3c5942b685..c9df8a135fe 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index fb67c07cfe9..6ae556874bb 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index e3e769253f1..c4543df0d16 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0303f580e67..474b3a5ce63 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -435,7 +433,8 @@ int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short /* ...................................... */ /* helper for calc_fcurve_* functions -> find first and last BezTriple to be used */ -static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple **last, const short selOnly) +static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple **last, + const short do_sel_only) { /* init outputs */ *first = NULL; @@ -446,7 +445,7 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple return; /* only include selected items? */ - if (selOnly) { + if (do_sel_only) { BezTriple *bezt; unsigned int i; @@ -477,11 +476,12 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple /* Calculate the extents of F-Curve's data */ -void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly) +void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, + const short do_sel_only) { float xminv=999999999.0f, xmaxv=-999999999.0f; float yminv=999999999.0f, ymaxv=-999999999.0f; - short foundvert=0; + short foundvert= FALSE; unsigned int i; if (fcu->totvert) { @@ -490,7 +490,7 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo if (xmin || xmax) { /* get endpoint keyframes */ - get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, selOnly); + get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); if (bezt_first) { BLI_assert(bezt_last != NULL); @@ -505,11 +505,12 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo BezTriple *bezt; for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) { - if ((selOnly == 0) || BEZSELECTED(bezt)) { + if ((do_sel_only == 0) || BEZSELECTED(bezt)) { if (bezt->vec[1][1] < yminv) yminv= bezt->vec[1][1]; if (bezt->vec[1][1] > ymaxv) ymaxv= bezt->vec[1][1]; + foundvert= TRUE; } } } @@ -530,11 +531,11 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo yminv= fpt->vec[1]; if (fpt->vec[1] > ymaxv) ymaxv= fpt->vec[1]; + + foundvert= TRUE; } } } - - foundvert=1; } if (foundvert) { @@ -557,43 +558,50 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo } /* Calculate the extents of F-Curve's keyframes */ -void calc_fcurve_range (FCurve *fcu, float *start, float *end, const short selOnly) +void calc_fcurve_range (FCurve *fcu, float *start, float *end, + const short do_sel_only, const short do_min_length) { float min=999999999.0f, max=-999999999.0f; - short foundvert=0; + short foundvert= FALSE; if (fcu->totvert) { if (fcu->bezt) { BezTriple *bezt_first= NULL, *bezt_last= NULL; /* get endpoint keyframes */ - get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, selOnly); - + get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); + if (bezt_first) { BLI_assert(bezt_last != NULL); - + min= MIN2(min, bezt_first->vec[1][0]); max= MAX2(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]); + + foundvert= TRUE; } - foundvert=1; } - /* minimum length is 1 frame */ - if (foundvert) { - if (min == max) max += 1.0f; - *start= min; - *end= max; + if (foundvert == FALSE) { + min= max= 0.0f; } - else { - *start= 0.0f; - *end= 1.0f; + + if (do_min_length) { + /* minimum length is 1 frame */ + if (min == max) { + max += 1.0f; + } } + + *start= min; + *end= max; } /* ----------------- Status Checks -------------------------- */ @@ -1170,16 +1178,16 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL); /* ... and from that, we get our transform */ - VECCOPY(tmp_loc, mat[3]); + copy_v3_v3(tmp_loc, mat[3]); } else { /* transform space (use transform values directly) */ - VECCOPY(tmp_loc, pchan->loc); + copy_v3_v3(tmp_loc, pchan->loc); } } else { /* convert to worldspace */ - VECCOPY(tmp_loc, pchan->pose_head); + copy_v3_v3(tmp_loc, pchan->pose_head); mul_m4_v3(ob->obmat, tmp_loc); } } @@ -1195,25 +1203,25 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) constraint_mat_convertspace(ob, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL); /* ... and from that, we get our transform */ - VECCOPY(tmp_loc, mat[3]); + copy_v3_v3(tmp_loc, mat[3]); } else { /* transform space (use transform values directly) */ - VECCOPY(tmp_loc, ob->loc); + copy_v3_v3(tmp_loc, ob->loc); } } else { /* worldspace */ - VECCOPY(tmp_loc, ob->obmat[3]); + copy_v3_v3(tmp_loc, ob->obmat[3]); } } /* copy the location to the right place */ if (tarIndex) { - VECCOPY(loc2, tmp_loc); + copy_v3_v3(loc2, tmp_loc); } else { - VECCOPY(loc1, tmp_loc); + copy_v3_v3(loc1, tmp_loc); } } DRIVER_TARGETS_LOOPER_END @@ -1254,7 +1262,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) if (pchan) { /* bone */ if (pchan->rotmode > 0) { - VECCOPY(oldEul, pchan->eul); + copy_v3_v3(oldEul, pchan->eul); rotOrder= pchan->rotmode; useEulers = 1; } @@ -1281,7 +1289,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) else { /* object */ if (ob->rotmode > 0) { - VECCOPY(oldEul, ob->rot); + copy_v3_v3(oldEul, ob->rot); rotOrder= ob->rotmode; useEulers = 1; } diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 9247646b927..bf432785064 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index d5c54893128..95c0aa60991 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 068e70bbb50..0761b8f14c7 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index fa493315d4b..adbc0f03528 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 41185c88179..b6dbd9e3659 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -1,5 +1,4 @@ /* - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 07bb4666134..bcbce2bc1c2 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 8d5668e241a..8dd0a318315 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 04fc41e41cc..ac4b936cb41 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 37982e7fec9..8bce7515695 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -62,10 +60,14 @@ #include "DNA_camera_types.h" #include "DNA_sequence_types.h" #include "DNA_userdef_types.h" +#include "DNA_brush_types.h" +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "BLI_blenlib.h" #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_bmfont.h" #include "BKE_global.h" @@ -315,6 +317,134 @@ Image *copy_image(Image *ima) return nima; } +static void extern_local_image(Image *UNUSED(ima)) +{ + /* Nothing to do: images don't link to other IDs. This function exists to + match id_make_local pattern. */ +} + +void make_local_image(struct Image *ima) +{ + Main *bmain= G.main; + Tex *tex; + Brush *brush; + Mesh *me; + int is_local= FALSE, is_lib= FALSE; + + /* - only lib users: do nothing + * - only local users: set flag + * - mixed: make copy + */ + + if(ima->id.lib==NULL) return; + + /* Can't take short cut here: must check meshes at least because of bogus + texface ID refs. - z0r */ +#if 0 + if(ima->id.us==1) { + id_clear_lib_data(bmain, &ima->id); + extern_local_image(ima); + return; + } +#endif + + for(tex= bmain->tex.first; tex; tex= tex->id.next) { + if(tex->ima == ima) { + if(tex->id.lib) is_lib= TRUE; + else is_local= TRUE; + } + } + for(brush= bmain->brush.first; brush; brush= brush->id.next) { + if(brush->clone.image == ima) { + if(brush->id.lib) is_lib= TRUE; + else is_local= TRUE; + } + } + for(me= bmain->mesh.first; me; me= me->id.next) { + if(me->mtface) { + MTFace *tface; + int a, i; + + for(i=0; i<me->fdata.totlayer; i++) { + if(me->fdata.layers[i].type == CD_MTFACE) { + tface= (MTFace*)me->fdata.layers[i].data; + + for(a=0; a<me->totface; a++, tface++) { + if(tface->tpage == ima) { + if(me->id.lib) is_lib= TRUE; + else is_local= TRUE; + } + } + } + } + } + } + + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &ima->id); + extern_local_image(ima); + } + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, ima->id.lib->filepath}; + Image *iman= copy_image(ima); + + iman->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, bpath_user_data); + + tex= bmain->tex.first; + while(tex) { + if(tex->id.lib==NULL) { + if(tex->ima==ima) { + tex->ima = iman; + iman->id.us++; + ima->id.us--; + } + } + tex= tex->id.next; + } + brush= bmain->brush.first; + while(brush) { + if(brush->id.lib==NULL) { + if(brush->clone.image==ima) { + brush->clone.image = iman; + iman->id.us++; + ima->id.us--; + } + } + brush= brush->id.next; + } + /* Transfer references in texfaces. Texfaces don't add to image ID + user count *unless* there are no other users. See + readfile.c:lib_link_mtface. */ + me= bmain->mesh.first; + while(me) { + if(me->mtface) { + MTFace *tface; + int a, i; + + for(i=0; i<me->fdata.totlayer; i++) { + if(me->fdata.layers[i].type == CD_MTFACE) { + tface= (MTFace*)me->fdata.layers[i].data; + + for(a=0; a<me->totface; a++, tface++) { + if(tface->tpage == ima) { + tface->tpage = iman; + if(iman->id.us == 0) { + tface->tpage->id.us= 1; + } + id_lib_extern((ID*)iman); + } + } + } + } + } + me= me->id.next; + } + } +} + void BKE_image_merge(Image *dest, Image *source) { ImBuf *ibuf; @@ -1370,7 +1500,7 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co } /* used by sequencer too */ -struct anim *openanim(char *name, int flags, int streamindex) +struct anim *openanim(const char *name, int flags, int streamindex) { struct anim *anim; struct ImBuf *ibuf; @@ -1818,7 +1948,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) flag = IB_rect|IB_multilayer; if(ima->flag & IMA_DO_PREMUL) flag |= IB_premul; - ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag); + ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag, "<packed data>"); } else { flag= IB_rect|IB_multilayer|IB_metadata; diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index f4d1ff4241d..751980f61e8 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index cef3eee8c5e..313143f362b 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 609f6cd38f1..85e00bcea06 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 3baf8e04b90..0a467142f74 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -183,7 +181,7 @@ void make_local_key(Key *key) if(key==NULL) return; key->id.lib= NULL; - new_id(NULL, (ID *)key, NULL); + new_id(NULL, &key->id, NULL); } /* Sort shape keys and Ipo curves after a change. This assumes that at most @@ -507,7 +505,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char ** co= MEM_callocN(sizeof(float)*3*me->edit_mesh->totvert, "key_block_get_data"); for(eve=me->edit_mesh->verts.first; eve; eve=eve->next, a++) - VECCOPY(co[a], eve->co); + copy_v3_v3(co[a], eve->co); *freedata= (char*)co; return (char*)co; @@ -1570,7 +1568,7 @@ void latt_to_key(Lattice *lt, KeyBlock *kb) bp= lt->def; fp= kb->data; for(a=0; a<kb->totelem; a++, fp+=3, bp++) { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); } } @@ -1587,7 +1585,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt) tot= MIN2(kb->totelem, tot); for(a=0; a<tot; a++, fp+=3, bp++) { - VECCOPY(bp->vec, fp); + copy_v3_v3(bp->vec, fp); } } @@ -1617,11 +1615,11 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb) bezt= nu->bezt; a= nu->pntsu; while(a--) { - VECCOPY(fp, bezt->vec[0]); + copy_v3_v3(fp, bezt->vec[0]); fp+= 3; - VECCOPY(fp, bezt->vec[1]); + copy_v3_v3(fp, bezt->vec[1]); fp+= 3; - VECCOPY(fp, bezt->vec[2]); + copy_v3_v3(fp, bezt->vec[2]); fp+= 3; fp[0]= bezt->alfa; fp+= 3; /* alphas */ @@ -1632,7 +1630,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb) bp= nu->bp; a= nu->pntsu*nu->pntsv; while(a--) { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp[3]= bp->alfa; fp+= 4; @@ -1664,11 +1662,11 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) bezt= nu->bezt; a= nu->pntsu; while(a-- && tot>0) { - VECCOPY(bezt->vec[0], fp); + copy_v3_v3(bezt->vec[0], fp); fp+= 3; - VECCOPY(bezt->vec[1], fp); + copy_v3_v3(bezt->vec[1], fp); fp+= 3; - VECCOPY(bezt->vec[2], fp); + copy_v3_v3(bezt->vec[2], fp); fp+= 3; bezt->alfa= fp[0]; fp+= 3; /* alphas */ @@ -1681,7 +1679,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) bp= nu->bp; a= nu->pntsu*nu->pntsv; while(a-- && tot>0) { - VECCOPY(bp->vec, fp); + copy_v3_v3(bp->vec, fp); bp->alfa= fp[3]; fp+= 4; @@ -1710,7 +1708,7 @@ void mesh_to_key(Mesh *me, KeyBlock *kb) mvert= me->mvert; fp= kb->data; for(a=0; a<kb->totelem; a++, fp+=3, mvert++) { - VECCOPY(fp, mvert->co); + copy_v3_v3(fp, mvert->co); } } @@ -1727,7 +1725,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me) tot= MIN2(kb->totelem, me->totvert); for(a=0; a<tot; a++, fp+=3, mvert++) { - VECCOPY(mvert->co, fp); + copy_v3_v3(mvert->co, fp); } } diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index cbff9c2337e..9a528b54143 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -41,6 +39,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -248,7 +247,7 @@ void make_local_lattice(Lattice *lt) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -257,28 +256,28 @@ void make_local_lattice(Lattice *lt) if(lt->id.lib==NULL) return; if(lt->id.us==1) { - lt->id.lib= NULL; - lt->id.flag= LIB_LOCAL; - new_id(&bmain->latt, (ID *)lt, NULL); + id_clear_lib_data(bmain, <->id); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) { if(ob->data==lt) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - lt->id.lib= NULL; - lt->id.flag= LIB_LOCAL; - new_id(&bmain->latt, (ID *)lt, NULL); + if(is_local && is_lib==FALSE) { + id_clear_lib_data(bmain, <->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bath_user_data[2]= {bmain->name, lt->id.lib->filepath}; Lattice *ltn= copy_lattice(lt); ltn->id.us= 0; + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, <n->id, bpath_relocate_visitor, 0, bath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data==lt) { if(ob->id.lib==NULL) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 6363512a36a..6cefa1b2a42 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1,6 +1,4 @@ -/* - * $Id$ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -76,7 +74,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" - +#include "BLI_bpath.h" #include "BKE_animsys.h" #include "BKE_context.h" @@ -110,6 +108,7 @@ #include "BKE_gpencil.h" #include "BKE_fcurve.h" #include "BKE_speaker.h" +#include "BKE_utildefines.h" #include "BKE_linestyle.h" #include "RNA_access.h" @@ -197,7 +196,8 @@ int id_make_local(ID *id, int test) if(!test) make_local_texture((Tex*)id); return 1; case ID_IM: - return 0; /* not implemented */ + if(!test) make_local_image((Image*)id); + return 1; case ID_LT: if(!test) { make_local_lattice((Lattice*)id); @@ -1262,6 +1262,17 @@ int new_id(ListBase *lb, ID *id, const char *tname) return result; } +/* Pull an ID out of a library (make it local). Only call this for IDs that + don't have other library users. */ +void id_clear_lib_data(Main *bmain, ID *id) +{ + char *bpath_user_data[2]= {bmain->name, id->lib->filepath}; + bpath_traverse_id(bmain, id, bpath_relocate_visitor, 0, bpath_user_data); + id->lib= NULL; + id->flag= LIB_LOCAL; + new_id(which_libbase(bmain, GS(id->name)), id, NULL); +} + /* next to indirect usage in read/writefile also in editobject.c scene.c */ void clear_id_newpoins(void) { @@ -1280,16 +1291,6 @@ void clear_id_newpoins(void) } } -/* only for library fixes */ -static void image_fix_relative_path(Image *ima) -{ - if(ima->id.lib==NULL) return; - if(strncmp(ima->name, "//", 2)==0) { - BLI_path_abs(ima->name, ima->id.lib->filepath); - BLI_path_rel(ima->name, G.main->name); - } -} - #define LIBTAG(a) if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;} static void lib_indirect_test_id(ID *id, Library *lib) @@ -1364,14 +1365,15 @@ void tag_main(struct Main *mainvar, const short tag) } } -/* if lib!=NULL, only all from lib local */ -void all_local(Library *lib, int untagged_only) +/* if lib!=NULL, only all from lib local + * bmain is almost certainly G.main */ +void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only) { ListBase *lbarray[MAX_LIBARRAY], tempbase={NULL, NULL}; ID *id, *idn; int a; - a= set_listbasepointers(G.main, lbarray); + a= set_listbasepointers(bmain, lbarray); while(a--) { id= lbarray[a]->first; @@ -1388,17 +1390,16 @@ void all_local(Library *lib, int untagged_only) (untagged_only==0 || !(id->flag & LIB_PRE_EXISTING))) { if(lib==NULL || id->lib==lib) { - id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); - if(id->lib) { - /* relative file patch */ - if(GS(id->name)==ID_IM) - image_fix_relative_path((Image *)id); - - id->lib= NULL; - new_id(lbarray[a], id, NULL); /* new_id only does it with double names */ + id_clear_lib_data(bmain, id); /* sets 'id->flag' */ + + /* why sort alphabetically here but not in + * id_clear_lib_data() ? - campbell */ sort_alpha_id(lbarray[a], id); } + else { + id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); + } } } id= idn; @@ -1413,7 +1414,7 @@ void all_local(Library *lib, int untagged_only) } /* patch 3: make sure library data isn't indirect falsely... */ - a= set_listbasepointers(G.main, lbarray); + a= set_listbasepointers(bmain, lbarray); while(a--) { for(id= lbarray[a]->first; id; id=id->next) lib_indirect_test_id(id, lib); @@ -1477,3 +1478,26 @@ void name_uiprefix_id(char *name, ID *id) strcpy(name+3, id->name+2); } + +void BKE_library_filepath_set(Library *lib, const char *filepath) +{ + /* in some cases this is used to update the absolute path from the + * relative */ + if (lib->name != filepath) { + BLI_strncpy(lib->name, filepath, sizeof(lib->name)); + } + + BLI_strncpy(lib->filepath, filepath, sizeof(lib->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) { + /* 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 + * since making local could cause this to be directly linked - campbell + */ + const char *basepath= lib->parent ? lib->parent->filepath : G.main->name; + BLI_path_abs(lib->filepath, basepath); + } +} diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 299de70e003..9a63e8d0e23 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -52,6 +50,7 @@ #include "BLI_math.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_animsys.h" #include "BKE_displist.h" @@ -288,8 +287,7 @@ void make_local_material(Material *ma) Mesh *me; Curve *cu; MetaBall *mb; - Material *man; - int a, local=0, lib=0; + int a, is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -297,23 +295,24 @@ void make_local_material(Material *ma) */ if(ma->id.lib==NULL) return; - if(ma->id.us==1) { - ma->id.lib= NULL; - ma->id.flag= LIB_LOCAL; - new_id(&bmain->mat, (ID *)ma, NULL); + /* One local user; set flag and return. */ + if(ma->id.us==1) { + id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); return; } - + + /* Check which other IDs reference this one to determine if it's used by + lib or local */ /* test objects */ ob= bmain->object.first; while(ob) { if(ob->mat) { for(a=0; a<ob->totcol; a++) { if(ob->mat[a]==ma) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } @@ -325,8 +324,8 @@ void make_local_material(Material *ma) if(me->mat) { for(a=0; a<me->totcol; a++) { if(me->mat[a]==ma) { - if(me->id.lib) lib= 1; - else local= 1; + if(me->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } @@ -338,8 +337,8 @@ void make_local_material(Material *ma) if(cu->mat) { for(a=0; a<cu->totcol; a++) { if(cu->mat[a]==ma) { - if(cu->id.lib) lib= 1; - else local= 1; + if(cu->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } @@ -351,26 +350,29 @@ void make_local_material(Material *ma) if(mb->mat) { for(a=0; a<mb->totcol; a++) { if(mb->mat[a]==ma) { - if(mb->id.lib) lib= 1; - else local= 1; + if(mb->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } mb= mb->id.next; } - - if(local && lib==0) { - ma->id.lib= NULL; - ma->id.flag= LIB_LOCAL; - new_id(&bmain->mat, (ID *)ma, NULL); + /* Only local users. */ + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); } - else if(local && lib) { - - man= copy_material(ma); + /* Both user and local, so copy. */ + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, ma->id.lib->filepath}; + Material *man= copy_material(ma); + man->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &man->id, bpath_relocate_visitor, 0, bpath_user_data); + /* do objects */ ob= bmain->object.first; while(ob) { diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 05d07ddf918..98646bd2faa 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -52,7 +50,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" - +#include "BLI_bpath.h" #include "BKE_global.h" @@ -149,7 +147,7 @@ void make_local_mball(MetaBall *mb) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -158,32 +156,31 @@ void make_local_mball(MetaBall *mb) if(mb->id.lib==NULL) return; if(mb->id.us==1) { - mb->id.lib= NULL; - mb->id.flag= LIB_LOCAL; - new_id(&bmain->mball, (ID *)mb, NULL); + id_clear_lib_data(bmain, &mb->id); extern_local_mball(mb); return; } - for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(ob->data == mb) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - mb->id.lib= NULL; - mb->id.flag= LIB_LOCAL; - - new_id(&bmain->mball, (ID *)mb, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &mb->id); extern_local_mball(mb); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, mb->id.lib->filepath}; MetaBall *mbn= copy_mball(mb); mbn->id.us= 0; + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &mbn->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= G.main->object.first; ob; ob= ob->id.next) { if(ob->data == mb) { if(ob->id.lib==NULL) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 9574c886ccc..50525c2b9cd 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -45,6 +43,7 @@ #include "DNA_ipo_types.h" #include "BLI_blenlib.h" +#include "BLI_bpath.h" #include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_edgehash.h" @@ -243,39 +242,26 @@ Mesh *copy_mesh(Mesh *me) return men; } -static void make_local_tface(Main *bmain, Mesh *me) +static void expand_local_mesh(Mesh *me) { - MTFace *tface; - Image *ima; - int a, i; - - for(i=0; i<me->fdata.totlayer; i++) { - if(me->fdata.layers[i].type == CD_MTFACE) { - tface= (MTFace*)me->fdata.layers[i].data; - - for(a=0; a<me->totface; a++, tface++) { - /* special case: ima always local immediately */ - if(tface->tpage) { - ima= tface->tpage; - if(ima->id.lib) { - ima->id.lib= NULL; - ima->id.flag= LIB_LOCAL; - new_id(&bmain->image, (ID *)ima, NULL); + id_lib_extern((ID *)me->texcomesh); + + if(me->mtface) { + MTFace *tface; + int a, i; + + for(i=0; i<me->fdata.totlayer; i++) { + if(me->fdata.layers[i].type == CD_MTFACE) { + tface= (MTFace*)me->fdata.layers[i].data; + + for(a=0; a<me->totface; a++, tface++) { + if(tface->tpage) { + id_lib_extern((ID *)tface->tpage); } } } } } -} - -static void expand_local_mesh(Main *bmain, Mesh *me) -{ - id_lib_extern((ID *)me->texcomesh); - - if(me->mtface) { - /* why is this an exception? - should not really make local when extern'ing - campbell */ - make_local_tface(bmain, me); - } if(me->mat) { extern_local_matarar(me->mat, me->totcol); @@ -286,7 +272,7 @@ void make_local_mesh(Mesh *me) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -295,32 +281,31 @@ void make_local_mesh(Mesh *me) if(me->id.lib==NULL) return; if(me->id.us==1) { - me->id.lib= NULL; - me->id.flag= LIB_LOCAL; - - new_id(&bmain->mesh, (ID *)me, NULL); - expand_local_mesh(bmain, me); + id_clear_lib_data(bmain, &me->id); + expand_local_mesh(me); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(me == ob->data) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - me->id.lib= NULL; - me->id.flag= LIB_LOCAL; - - new_id(&bmain->mesh, (ID *)me, NULL); - expand_local_mesh(bmain, me); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &me->id); + expand_local_mesh(me); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, me->id.lib->filepath}; Mesh *men= copy_mesh(me); men->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &men->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(me == ob->data) { if(ob->id.lib==NULL) { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 4d735f1d54b..0dac4b8cd80 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -117,9 +115,10 @@ static int search_face_cmp(const void *v1, const void *v2) } +#define PRINT if(do_verbose) printf + int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totvert, MEdge *medges, unsigned int totedge, MFace *mfaces, unsigned int totface, const short do_verbose, const short do_fixes) { -# define PRINT if(do_verbose) printf # define REMOVE_EDGE_TAG(_med) { _med->v2= _med->v1; do_edge_free= 1; } # define REMOVE_FACE_TAG(_mf) { _mf->v3=0; do_face_free= 1; } @@ -284,7 +283,6 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve PRINT("BKE_mesh_validate: finished\n\n"); -# undef PRINT # undef REMOVE_EDGE_TAG # undef REMOVE_FACE_TAG @@ -305,12 +303,57 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve return (do_face_free || do_edge_free || do_edge_recalc); } +static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes) +{ + int i= 0, has_fixes= 0; + + while(i<data->totlayer) { + CustomDataLayer *layer= &data->layers[i]; + int mask= 1 << layer->type; + int ok= 1; + + if((mask&CD_MASK_MESH)==0) { + PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type); + + if(do_fixes) { + CustomData_free_layer(data, layer->type, 0, i); + ok= 0; + has_fixes= 1; + } + } + + if(ok) + i++; + } + + return has_fixes; +} + +#undef PRINT + +int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata, short do_verbose, const short do_fixes) +{ + int vfixed= 0, efixed= 0, ffixed= 0; + + vfixed= mesh_validate_customdata(vdata, do_verbose, do_fixes); + efixed= mesh_validate_customdata(edata, do_verbose, do_fixes); + ffixed= mesh_validate_customdata(fdata, do_verbose, do_fixes); + + return vfixed || efixed || ffixed; +} + int BKE_mesh_validate(Mesh *me, int do_verbose) { + int layers_fixed= 0, arrays_fixed= 0; + if(do_verbose) { printf("MESH: %s\n", me->id.name+2); } - return BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE); + + layers_fixed= BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->fdata, do_verbose, TRUE); + arrays_fixed= BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE); + + return layers_fixed || arrays_fixed; } int BKE_mesh_validate_dm(DerivedMesh *dm) diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 2056762e627..bbc1b596889 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 749930d4278..6579d7a01f4 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c index f670486484b..e3b5b83964e 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ b/source/blender/blenkernel/intern/navmesh_conversion.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 15513675c7a..fd5c7912e1f 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index cb1f52a6265..824e59a82c5 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1041,6 +1039,7 @@ static void ntreeMakeLocal_LinkNew(void *calldata, ID *owner_id, bNodeTree *ntre void ntreeMakeLocal(bNodeTree *ntree) { + Main *bmain= G.main; bNodeTreeType *treetype= ntreeGetType(ntree->type); MakeLocalCallData cd; @@ -1051,9 +1050,7 @@ void ntreeMakeLocal(bNodeTree *ntree) if(ntree->id.lib==NULL) return; if(ntree->id.us==1) { - ntree->id.lib= NULL; - ntree->id.flag= LIB_LOCAL; - new_id(NULL, (ID *)ntree, NULL); + id_clear_lib_data(bmain, (ID *)ntree); return; } @@ -1067,9 +1064,7 @@ void ntreeMakeLocal(bNodeTree *ntree) /* if all users are local, we simply make tree local */ if(cd.local && cd.lib==0) { - ntree->id.lib= NULL; - ntree->id.flag= LIB_LOCAL; - new_id(NULL, (ID *)ntree, NULL); + id_clear_lib_data(bmain, (ID *)ntree); } else if(cd.local && cd.lib) { /* this is the mixed case, we copy the tree and assign it to local users */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3e4413cec41..377226af461 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -58,6 +56,7 @@ #include "DNA_world_types.h" #include "BLI_blenlib.h" +#include "BLI_bpath.h" #include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_pbvh.h" @@ -759,7 +758,7 @@ void make_local_camera(Camera *cam) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -768,28 +767,29 @@ void make_local_camera(Camera *cam) if(cam->id.lib==NULL) return; if(cam->id.us==1) { - cam->id.lib= NULL; - cam->id.flag= LIB_LOCAL; - new_id(&bmain->camera, (ID *)cam, NULL); + id_clear_lib_data(bmain, &cam->id); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(ob->data==cam) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - cam->id.lib= NULL; - cam->id.flag= LIB_LOCAL; - new_id(&bmain->camera, (ID *)cam, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &cam->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, cam->id.lib->filepath}; Camera *camn= copy_camera(cam); + camn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &camn->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data == cam) { if(ob->id.lib==NULL) { @@ -923,8 +923,7 @@ void make_local_lamp(Lamp *la) { Main *bmain= G.main; Object *ob; - Lamp *lan; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -933,30 +932,31 @@ void make_local_lamp(Lamp *la) if(la->id.lib==NULL) return; if(la->id.us==1) { - la->id.lib= NULL; - la->id.flag= LIB_LOCAL; - new_id(&bmain->lamp, (ID *)la, NULL); + id_clear_lib_data(bmain, &la->id); return; } ob= bmain->object.first; while(ob) { if(ob->data==la) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } ob= ob->id.next; } - if(local && lib==0) { - la->id.lib= NULL; - la->id.flag= LIB_LOCAL; - new_id(&bmain->lamp, (ID *)la, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &la->id); } - else if(local && lib) { - lan= copy_lamp(la); + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, la->id.lib->filepath}; + Lamp *lan= copy_lamp(la); lan->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &lan->id, bpath_relocate_visitor, 0, bpath_user_data); + ob= bmain->object.first; while(ob) { if(ob->data==la) { @@ -1468,7 +1468,7 @@ void make_local_object(Object *ob) Main *bmain= G.main; Scene *sce; Base *base; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -1480,27 +1480,30 @@ void make_local_object(Object *ob) ob->proxy= ob->proxy_from= NULL; if(ob->id.us==1) { - ob->id.lib= NULL; - ob->id.flag= LIB_LOCAL; - new_id(&bmain->object, (ID *)ob, NULL); + id_clear_lib_data(bmain, &ob->id); + extern_local_object(ob); } else { - for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) { + for(sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) { if(object_in_scene(ob, sce)) { - if(sce->id.lib) lib= 1; - else local= 1; + if(sce->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - ob->id.lib= NULL; - ob->id.flag= LIB_LOCAL; - new_id(&bmain->object, (ID *)ob, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &ob->id); + extern_local_object(ob); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, ob->id.lib->filepath}; Object *obn= copy_object(ob); + obn->id.us= 0; + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &obn->id, bpath_relocate_visitor, 0, bpath_user_data); + sce= bmain->scene.first; while(sce) { if(sce->id.lib==NULL) { @@ -1518,8 +1521,6 @@ void make_local_object(Object *ob) } } } - - extern_local_object(ob); } /* @@ -2042,7 +2043,7 @@ static void give_parvert(Object *par, int nr, float *vec) while(a--) { if(count==nr) { found= 1; - VECCOPY(vec, bezt->vec[1]); + copy_v3_v3(vec, bezt->vec[1]); break; } count++; @@ -2110,7 +2111,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4]) copy_m4_m3(mat, cmat); if(ob->type==OB_CURVE) { - VECCOPY(mat[3], v1); + copy_v3_v3(mat[3], v1); } else { add_v3_v3v3(mat[3], v1, v2); @@ -2234,7 +2235,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[ case PARVERT1: unit_m4(totmat); if (simul){ - VECCOPY(totmat[3], par->obmat[3]); + copy_v3_v3(totmat[3], par->obmat[3]); } else{ give_parvert(par, ob->par1, vec); @@ -2268,10 +2269,10 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[ // origin, voor help line if( (ob->partype & PARTYPE)==PARSKEL ) { - VECCOPY(ob->orig, par->obmat[3]); + copy_v3_v3(ob->orig, par->obmat[3]); } else { - VECCOPY(ob->orig, totmat[3]); + copy_v3_v3(ob->orig, totmat[3]); } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 70b0b7727c4..ea1dbec8a27 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index ddeb42d608e..56ce853bfb9 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 8a83dcac765..a1ed0862336 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -55,6 +53,7 @@ #include "BLI_rand.h" #include "BLI_threads.h" #include "BLI_linklist.h" +#include "BLI_bpath.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -3603,7 +3602,7 @@ void make_local_particlesettings(ParticleSettings *part) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -3612,34 +3611,35 @@ void make_local_particlesettings(ParticleSettings *part) if(part->id.lib==0) return; if(part->id.us==1) { - part->id.lib= 0; - part->id.flag= LIB_LOCAL; - new_id(&bmain->particle, (ID *)part, 0); + id_clear_lib_data(bmain, &part->id); expand_local_particlesettings(part); return; } /* test objects */ - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) { ParticleSystem *psys=ob->particlesystem.first; for(; psys; psys=psys->next){ if(psys->part==part) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } - if(local && lib==0) { - part->id.lib= 0; - part->id.flag= LIB_LOCAL; - new_id(&bmain->particle, (ID *)part, 0); + if(is_local && is_lib==FALSE) { + id_clear_lib_data(bmain, &part->id); expand_local_particlesettings(part); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, part->id.lib->filepath}; ParticleSettings *partn= psys_copy_settings(part); + partn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &partn->id, bpath_relocate_visitor, 0, bpath_user_data); + /* do objects */ for(ob= bmain->object.first; ob; ob= ob->id.next) { ParticleSystem *psys; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index cebefe81495..f904f246b65 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -3855,8 +3853,9 @@ static void update_children(ParticleSimulationData *sim) else if(sim->psys->part->childtype) { if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys)) distribute_particles(sim, PART_FROM_CHILD); - else - ; /* Children are up to date, nothing to do. */ + else { + /* Children are up to date, nothing to do. */ + } } else psys_free_children(sim->psys); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index d4753f30ef2..fa9d94eb24d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index e0e2876f79e..f9d470e48d8 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 4926edaeec2..ffa9e027108 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index a75a075dfc1..f7eda6bd9b3 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index dfbb0f6318a..a8f6d320f5f 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index ef1b75e5913..02e6fe945f3 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -1,5 +1,4 @@ /* - * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c index 77a79a6c8a4..5fadebc80f8 100644 --- a/source/blender/blenkernel/intern/script.c +++ b/source/blender/blenkernel/intern/script.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 88e9d9209d4..c5761dcc456 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -19,6 +17,8 @@ * * Peter Schlaile <peter [at] schlaile [dot] de> 2010 * + * Contributor(s): Sergey Sharybin + * * ***** END GPL LICENSE BLOCK ***** */ @@ -28,22 +28,15 @@ #include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> + +#include "BLO_sys_types.h" /* for intptr_t */ #include "MEM_guardedalloc.h" -#include "MEM_CacheLimiterC-Api.h" #include "DNA_sequence_types.h" #include "BKE_sequencer.h" -#include "BLI_utildefines.h" -#include "BLI_ghash.h" -#include "BLI_mempool.h" -#include <pthread.h> -#include "IMB_imbuf.h" -#include "IMB_imbuf_types.h" +#include "IMB_moviecache.h" typedef struct seqCacheKey { @@ -53,20 +46,9 @@ typedef struct seqCacheKey seq_stripelem_ibuf_t type; } seqCacheKey; -typedef struct seqCacheEntry -{ - ImBuf * ibuf; - MEM_CacheLimiterHandleC * c_handle; -} seqCacheEntry; - -static GHash * hash = NULL; -static MEM_CacheLimiterC * limitor = NULL; -static struct BLI_mempool * entrypool = NULL; -static struct BLI_mempool * keypool = NULL; -static int ibufs_in = 0; -static int ibufs_rem = 0; - -static unsigned int HashHash(const void *key_) +static struct MovieCache *moviecache = NULL; + +static unsigned int seqcache_hashhash(const void *key_) { const seqCacheKey *key = (seqCacheKey*) key_; unsigned int rval = seq_hash_render_data(&key->context); @@ -78,7 +60,7 @@ static unsigned int HashHash(const void *key_) return rval; } -static int HashCmp(const void *a_, const void *b_) +static int seqcache_hashcmp(const void *a_, const void *b_) { const seqCacheKey * a = (seqCacheKey*) a_; const seqCacheKey * b = (seqCacheKey*) b_; @@ -107,109 +89,37 @@ static int HashCmp(const void *a_, const void *b_) return seq_cmp_render_data(&a->context, &b->context); } -static void HashKeyFree(void *key) -{ - BLI_mempool_free(keypool, key); -} - -static void HashValFree(void *val) -{ - seqCacheEntry* e = (seqCacheEntry*) val; - - if (e->ibuf) { - /* fprintf(stderr, "Removing: %p, cnt: %d\n", e->ibuf, - e->ibuf->refcounter); */ - IMB_freeImBuf(e->ibuf); - MEM_CacheLimiter_unmanage(e->c_handle); - ibufs_rem++; - } - - e->ibuf = NULL; - e->c_handle = NULL; - - BLI_mempool_free(entrypool, e); -} - -static void IMB_seq_cache_destructor(void * p) -{ - seqCacheEntry* e = (seqCacheEntry*) p; - - if (e && e->ibuf) { - /* fprintf(stderr, "Removing: %p, cnt: %d\n", e->ibuf, - e->ibuf->refcounter); */ - IMB_freeImBuf(e->ibuf); - ibufs_rem++; - - e->ibuf = NULL; - e->c_handle = NULL; - } -} - -void seq_stripelem_cache_init(void) -{ - hash = BLI_ghash_new(HashHash, HashCmp, "seq stripelem cache hash"); - limitor = new_MEM_CacheLimiter( IMB_seq_cache_destructor ); - - entrypool = BLI_mempool_create(sizeof(seqCacheEntry), 64, 64, 0); - keypool = BLI_mempool_create(sizeof(seqCacheKey), 64, 64, 0); -} - void seq_stripelem_cache_destruct(void) { - if (!entrypool) { - return; - } - BLI_ghash_free(hash, HashKeyFree, HashValFree); - delete_MEM_CacheLimiter(limitor); - BLI_mempool_destroy(entrypool); - BLI_mempool_destroy(keypool); + if(moviecache) + IMB_moviecache_free(moviecache); } void seq_stripelem_cache_cleanup(void) { - if (!entrypool) { - seq_stripelem_cache_init(); + if(moviecache) { + IMB_moviecache_free(moviecache); + moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash, + seqcache_hashcmp, NULL); } - - /* fprintf(stderr, "Stats before cleanup: in: %d rem: %d\n", - ibufs_in, ibufs_rem); */ - - BLI_ghash_free(hash, HashKeyFree, HashValFree); - hash = BLI_ghash_new(HashHash, HashCmp, "seq stripelem cache hash"); - - /* fprintf(stderr, "Stats after cleanup: in: %d rem: %d\n", - ibufs_in, ibufs_rem); */ - } struct ImBuf * seq_stripelem_cache_get( SeqRenderData context, struct Sequence * seq, float cfra, seq_stripelem_ibuf_t type) { - seqCacheKey key; - seqCacheEntry * e; - if (!seq) { - return NULL; - } + if(moviecache && seq) { + seqCacheKey key; - if (!entrypool) { - seq_stripelem_cache_init(); - } + key.seq = seq; + key.context = context; + key.cfra = cfra - seq->start; + key.type = type; - key.seq = seq; - key.context = context; - key.cfra = cfra - seq->start; - key.type = type; - - e = (seqCacheEntry*) BLI_ghash_lookup(hash, &key); - - if (e && e->ibuf) { - IMB_refImBuf(e->ibuf); - - MEM_CacheLimiter_touch(e->c_handle); - return e->ibuf; + return IMB_moviecache_get(moviecache, &key); } + return NULL; } @@ -217,39 +127,21 @@ void seq_stripelem_cache_put( SeqRenderData context, struct Sequence * seq, float cfra, seq_stripelem_ibuf_t type, struct ImBuf * i) { - seqCacheKey * key; - seqCacheEntry * e; + seqCacheKey key; if (!i) { return; } - ibufs_in++; - - if (!entrypool) { - seq_stripelem_cache_init(); + if(!moviecache) { + moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash, + seqcache_hashcmp, NULL); } - key = (seqCacheKey*) BLI_mempool_alloc(keypool); - - key->seq = seq; - key->context = context; - key->cfra = cfra - seq->start; - key->type = type; - - IMB_refImBuf(i); - - e = (seqCacheEntry*) BLI_mempool_alloc(entrypool); - - e->ibuf = i; - e->c_handle = NULL; - - BLI_ghash_remove(hash, key, HashKeyFree, HashValFree); - BLI_ghash_insert(hash, key, e); - - e->c_handle = MEM_CacheLimiter_insert(limitor, e); + key.seq = seq; + key.context = context; + key.cfra = cfra - seq->start; + key.type = type; - MEM_CacheLimiter_ref(e->c_handle); - MEM_CacheLimiter_enforce_limits(limitor); - MEM_CacheLimiter_unref(e->c_handle); + IMB_moviecache_put(moviecache, &key, i); } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 943066537d5..3699cf40aa8 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index cf03a8d3f36..6b319e6b5e1 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1326,6 +1324,10 @@ static void seq_proxy_build_frame(SeqRenderData context, quality = seq->strip->proxy->quality; ibuf->ftype= JPG | quality; + /* unsupported feature only confuses other s/w */ + if(ibuf->depth==32) + ibuf->depth= 24; + BLI_make_existing_file(name); ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat); @@ -2503,9 +2505,6 @@ static void *seq_prefetch_thread(void * This_) for (e = prefetch_done.first; e; e = e->next) { if (s_last > e->monoton_cfra) { - if (e->ibuf) { - IMB_cache_limiter_unref(e->ibuf); - } BLI_remlink(&prefetch_done, e); MEM_freeN(e); } @@ -2583,9 +2582,6 @@ static void seq_stop_threads() } for (e = prefetch_done.first; e; e = e->next) { - if (e->ibuf) { - IMB_cache_limiter_unref(e->ibuf); - } BLI_remlink(&prefetch_done, e); MEM_freeN(e); } diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index d2d22aa213a..e47dcd68ce1 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index a5afc0afda1..faf382f9ffc 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index c1833b39b8b..ac2a840c95a 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index cd147f4dbed..28925a7b170 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 02e381fe9b4..ceaba2502d9 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index ae29230423f..d5788d7a748 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -36,6 +34,8 @@ #include "DNA_speaker_types.h" #include "BLI_math.h" +#include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_animsys.h" #include "BKE_global.h" @@ -80,7 +80,7 @@ void make_local_speaker(Speaker *spk) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -89,30 +89,30 @@ void make_local_speaker(Speaker *spk) if(spk->id.lib==NULL) return; if(spk->id.us==1) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); + id_clear_lib_data(bmain, &spk->id); return; } ob= bmain->object.first; while(ob) { if(ob->data==spk) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } ob= ob->id.next; } - if(local && lib==0) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &spk->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, spk->id.lib->filepath}; Speaker *spkn= copy_speaker(spk); spkn->id.us= 0; + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &spkn->id, bpath_relocate_visitor, 0, bpath_user_data); + ob= bmain->object.first; while(ob) { if(ob->data==spk) { diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index b111568fcf4..4e346b3f2d8 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 8a8bb6dd76a..48bc4926a85 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index b5fc76a8551..69af2570d0c 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 7d720aed62c..e3713b1e177 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -44,6 +42,7 @@ #include "BLI_math.h" #include "BLI_kdopbvh.h" #include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "DNA_key_types.h" #include "DNA_object_types.h" @@ -816,16 +815,20 @@ Tex *localize_texture(Tex *tex) /* ------------------------------------------------------------------------- */ +static void extern_local_texture(Tex *tex) +{ + id_lib_extern((ID *)tex->ima); +} + void make_local_texture(Tex *tex) { Main *bmain= G.main; - Tex *texn; Material *ma; World *wrld; Lamp *la; Brush *br; ParticleSettings *pa; - int a, local=0, lib=0; + int a, is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -834,18 +837,9 @@ void make_local_texture(Tex *tex) if(tex->id.lib==NULL) return; - /* special case: ima always local immediately */ - if(tex->ima) { - tex->ima->id.lib= NULL; - tex->ima->id.flag= LIB_LOCAL; - new_id(&bmain->image, (ID *)tex->ima, NULL); - } - if(tex->id.us==1) { - tex->id.lib= NULL; - tex->id.flag= LIB_LOCAL; - new_id(&bmain->tex, (ID *)tex, NULL); - + id_clear_lib_data(bmain, &tex->id); + extern_local_texture(tex); return; } @@ -853,8 +847,8 @@ void make_local_texture(Tex *tex) while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { - if(ma->id.lib) lib= 1; - else local= 1; + if(ma->id.lib) is_lib= TRUE; + else is_local= TRUE; } } ma= ma->id.next; @@ -863,8 +857,8 @@ void make_local_texture(Tex *tex) while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { - if(la->id.lib) lib= 1; - else local= 1; + if(la->id.lib) is_lib= TRUE; + else is_local= TRUE; } } la= la->id.next; @@ -873,8 +867,8 @@ void make_local_texture(Tex *tex) while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { - if(wrld->id.lib) lib= 1; - else local= 1; + if(wrld->id.lib) is_lib= TRUE; + else is_local= TRUE; } } wrld= wrld->id.next; @@ -882,8 +876,8 @@ void make_local_texture(Tex *tex) br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { - if(br->id.lib) lib= 1; - else local= 1; + if(br->id.lib) is_lib= TRUE; + else is_local= TRUE; } br= br->id.next; } @@ -891,21 +885,25 @@ void make_local_texture(Tex *tex) while(pa) { for(a=0; a<MAX_MTEX; a++) { if(pa->mtex[a] && pa->mtex[a]->tex==tex) { - if(pa->id.lib) lib= 1; - else local= 1; + if(pa->id.lib) is_lib= TRUE; + else is_local= TRUE; } } pa= pa->id.next; } - if(local && lib==0) { - tex->id.lib= NULL; - tex->id.flag= LIB_LOCAL; - new_id(&bmain->tex, (ID *)tex, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &tex->id); + extern_local_texture(tex); } - else if(local && lib) { - texn= copy_texture(tex); + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, tex->id.lib->filepath}; + Tex *texn= copy_texture(tex); + texn->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &texn->id, bpath_relocate_visitor, 0, bpath_user_data); ma= bmain->mat.first; while(ma) { diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 8aeef0d84b1..01b090f2967 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 7d278f37cfb..4d7a7c9a262 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -42,6 +40,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_world.h" #include "BKE_library.h" @@ -153,7 +152,7 @@ void make_local_world(World *wrld) { Main *bmain= G.main; Scene *sce; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -162,28 +161,28 @@ void make_local_world(World *wrld) if(wrld->id.lib==NULL) return; if(wrld->id.us==1) { - wrld->id.lib= NULL; - wrld->id.flag= LIB_LOCAL; - new_id(NULL, (ID *)wrld, NULL); + id_clear_lib_data(bmain, &wrld->id); return; } - for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) { + for(sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) { if(sce->world == wrld) { - if(sce->id.lib) lib= 1; - else local= 1; + if(sce->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - wrld->id.lib= NULL; - wrld->id.flag= LIB_LOCAL; - new_id(NULL, (ID *)wrld, NULL); + if(is_local && is_lib==FALSE) { + id_clear_lib_data(bmain, &wrld->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, wrld->id.lib->filepath}; World *wrldn= copy_world(wrld); wrldn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &wrldn->id, bpath_relocate_visitor, 0, bpath_user_data); + for(sce= bmain->scene.first; sce; sce= sce->id.next) { if(sce->world == wrld) { if(sce->id.lib==NULL) { diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index b989d44c391..03091a08c58 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 7b414f7746a..da1412dac0d 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1,5 +1,4 @@ /* - * $Id$ * * ffmpeg-write support * @@ -397,6 +396,20 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop) } } +static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProperty *curr) +{ + int valid= 1; + + if(strcmp(prop_name, "video")==0) { + if(strcmp(curr->name, "bf")==0) { + /* flash codec doesn't support b frames */ + valid&= c->codec_id!=CODEC_ID_FLV1; + } + } + + return valid; +} + static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char * prop_name) { IDProperty * prop; @@ -415,7 +428,8 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char iter = IDP_GetGroupIterator(prop); while ((curr = IDP_GroupIterNext(iter)) != NULL) { - set_ffmpeg_property_option(c, curr); + if(ffmpeg_proprty_valid(c, prop_name, curr)) + set_ffmpeg_property_option(c, curr); } } @@ -1088,7 +1102,7 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int idp_type = IDP_FLOAT; break; case FF_OPT_TYPE_STRING: - val.str = " "; + val.str = (char *)" "; idp_type = IDP_STRING; break; case FF_OPT_TYPE_CONST: @@ -1188,6 +1202,9 @@ void ffmpeg_set_preset(RenderData *rd, int preset) { int isntsc = (rd->frs_sec != 25); + if(rd->ffcodecdata.properties) + IDP_FreeProperty(rd->ffcodecdata.properties); + switch (preset) { case FFMPEG_PRESET_VCD: rd->ffcodecdata.type = FFMPEG_MPEG1; @@ -1218,8 +1235,11 @@ void ffmpeg_set_preset(RenderData *rd, int preset) case FFMPEG_PRESET_DVD: rd->ffcodecdata.type = FFMPEG_MPEG2; rd->ffcodecdata.video_bitrate = 6000; - rd->xsch = 720; - rd->ysch = isntsc ? 480 : 576; + + /* Don't set resolution, see [#21351] + * rd->xsch = 720; + * rd->ysch = isntsc ? 480 : 576; */ + rd->ffcodecdata.gop_size = isntsc ? 18 : 15; rd->ffcodecdata.rc_max_rate = 9000; rd->ffcodecdata.rc_min_rate = 0; @@ -1322,8 +1342,8 @@ void ffmpeg_verify_image_type(RenderData *rd) rd->ffcodecdata.video_bitrate <= 1) { rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO; - /* Don't set preset, disturbs render resolution. - * ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); */ + + ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); } if(rd->ffcodecdata.type == FFMPEG_OGG) { rd->ffcodecdata.type = FFMPEG_MPEG2; @@ -1357,4 +1377,3 @@ void ffmpeg_verify_image_type(RenderData *rd) } #endif - diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d42b952617f..ae65b913283 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -1,5 +1,4 @@ /* - * $Id$ * * Frameserver * Makes Blender accessible from TMPGenc directly using VFAPI (you can diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index 2db288192cc..e287606921b 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or |