From 675076a06ef38f7e565f4867b61564431803dc8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Oct 2011 11:06:52 +0000 Subject: cmake macro to set less strict flags per file - remove_strict_flags_file(file, file...) this way we can avoid removing strict flags for all files in blenkernel. --- source/blender/blenkernel/intern/writeffmpeg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index bdca3c8e618..da1412dac0d 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1102,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: @@ -1377,4 +1377,3 @@ void ffmpeg_verify_image_type(RenderData *rd) } #endif - -- cgit v1.2.3 From f09d36d6bce6f2fb9f618f9bf57a91a3502ba3eb Mon Sep 17 00:00:00 2001 From: Alex Fraser Date: Wed, 26 Oct 2011 10:49:21 +0000 Subject: Fix [#28772] Filepaths are not remmaped after making a library item local Added a visitor function to simplify processing of file paths that are attached to IDs. This is used for images, and could be used for other ID types in future. Code reviewed by ideasman_42. --- source/blender/blenkernel/BKE_library.h | 1 + source/blender/blenkernel/intern/action.c | 9 ++------- source/blender/blenkernel/intern/library.c | 16 ++++++++++++++-- source/blender/blenkernel/intern/object.c | 1 - 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 947eafa9dd3..77ce7a50956 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -59,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 ListBase *lb, struct ID *id); struct ListBase *which_libbase(struct Main *mainlib, short type); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index e46e2df8353..ac0697ddbf9 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -137,19 +137,14 @@ 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->action, (ID *)act); 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); + id_clear_lib_data(&bmain->action, (ID *)act); } else if (mlac.local && mlac.lib) { mlac.actn= copy_action(act); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c44ccd7aa57..0c2ca4c68b3 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -74,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" @@ -108,6 +108,7 @@ #include "BKE_gpencil.h" #include "BKE_fcurve.h" #include "BKE_speaker.h" +#include "BKE_utildefines.h" #include "RNA_access.h" @@ -194,7 +195,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); @@ -1246,6 +1248,16 @@ 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(ListBase *lb, ID *id) +{ + bpath_traverse_id(id, bpath_relocate_visitor, id->lib->filepath); + id->lib= NULL; + id->flag= LIB_LOCAL; + new_id(lb, id, NULL); +} + /* next to indirect usage in read/writefile also in editobject.c scene.c */ void clear_id_newpoins(void) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6e09aefeea2..1e5b69dc4ee 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1083,7 +1083,6 @@ Object *add_only_object(int type, const char *name) /* ob->pad3 == Contact Processing Threshold */ ob->m_contactProcessingThreshold = 1.; ob->obstacleRad = 1.; - ob->col_group = ob->col_mask = 1; /* NT fluid sim defaults */ ob->fluidsimFlag = 0; -- cgit v1.2.3 From ba0ef7a592ace7d6baa5c5f1342706de4e70b2e8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 26 Oct 2011 14:05:01 +0000 Subject: Fix #29030: render operator only used scene property if layers was used, now it is possible to specify the scene without the layer too. --- source/blender/blenkernel/intern/object.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1e5b69dc4ee..6e09aefeea2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1083,6 +1083,7 @@ Object *add_only_object(int type, const char *name) /* ob->pad3 == Contact Processing Threshold */ ob->m_contactProcessingThreshold = 1.; ob->obstacleRad = 1.; + ob->col_group = ob->col_mask = 1; /* NT fluid sim defaults */ ob->fluidsimFlag = 0; -- cgit v1.2.3 From a267f9ba4e7904c6e32e062aaccc282d974643bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Oct 2011 21:22:35 +0000 Subject: edits ontop of Alex's patch from r41292. pass main rather than use G.main when naming from -> to relative paths. --- source/blender/blenkernel/BKE_library.h | 2 +- source/blender/blenkernel/intern/action.c | 4 ++-- source/blender/blenkernel/intern/armature.c | 4 ++-- source/blender/blenkernel/intern/brush.c | 4 ++-- source/blender/blenkernel/intern/curve.c | 4 ++-- source/blender/blenkernel/intern/image.c | 14 ++++++++------ source/blender/blenkernel/intern/lattice.c | 4 ++-- source/blender/blenkernel/intern/library.c | 7 ++++--- source/blender/blenkernel/intern/material.c | 4 ++-- source/blender/blenkernel/intern/mball.c | 4 ++-- source/blender/blenkernel/intern/mesh.c | 4 ++-- source/blender/blenkernel/intern/node.c | 4 ++-- source/blender/blenkernel/intern/object.c | 13 ++++++------- source/blender/blenkernel/intern/particle.c | 4 ++-- source/blender/blenkernel/intern/speaker.c | 4 ++-- source/blender/blenkernel/intern/texture.c | 7 ++++--- source/blender/blenkernel/intern/world.c | 4 ++-- 17 files changed, 47 insertions(+), 44 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 77ce7a50956..59ced28d53e 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -59,7 +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 ListBase *lb, struct ID *id); +void id_clear_lib_data(struct Main *bmain, struct ID *id); struct ListBase *which_libbase(struct Main *mainlib, short type); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index ac0697ddbf9..d02a1d6dd27 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -137,14 +137,14 @@ 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)) { - id_clear_lib_data(&bmain->action, (ID *)act); + id_clear_lib_data(bmain, (ID *)act); return; } BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac); if (mlac.local && mlac.lib==0) { - id_clear_lib_data(&bmain->action, (ID *)act); + id_clear_lib_data(bmain, (ID *)act); } else if (mlac.local && mlac.lib) { mlac.actn= copy_action(act); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index c1675faf053..b4b5dfedad2 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -141,7 +141,7 @@ void make_local_armature(bArmature *arm) if (arm->id.lib==NULL) return; if (arm->id.us==1) { - id_clear_lib_data(&bmain->armature, (ID *)arm); + id_clear_lib_data(bmain, (ID *)arm); return; } @@ -153,7 +153,7 @@ void make_local_armature(bArmature *arm) } if(local && lib==0) { - id_clear_lib_data(&bmain->armature, (ID *)arm); + id_clear_lib_data(bmain, (ID *)arm); } else if(local && lib) { bArmature *armn= copy_armature(arm); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 45558329d4d..511f90f3d26 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -201,7 +201,7 @@ void make_local_brush(Brush *brush) if(brush->clone.image) { /* special case: ima always local immediately. Clone image should only have one user anyway. */ - id_clear_lib_data(&bmain->brush, (ID *)brush->clone.image); + id_clear_lib_data(bmain, (ID *)brush->clone.image); extern_local_brush(brush); } @@ -213,7 +213,7 @@ void make_local_brush(Brush *brush) } if(local && lib==0) { - id_clear_lib_data(&bmain->brush, (ID *)brush); + id_clear_lib_data(bmain, (ID *)brush); extern_local_brush(brush); /* enable fake user by default */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 4d93f2cba05..f5335bb12cd 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -255,7 +255,7 @@ void make_local_curve(Curve *cu) if(cu->id.lib==NULL) return; if(cu->id.us==1) { - id_clear_lib_data(&bmain->curve, (ID *)cu); + id_clear_lib_data(bmain, (ID *)cu); extern_local_curve(cu); return; } @@ -268,7 +268,7 @@ void make_local_curve(Curve *cu) } if(local && lib==0) { - id_clear_lib_data(&bmain->curve, (ID *)cu); + id_clear_lib_data(bmain, (ID *)cu); extern_local_curve(cu); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 5f7d2d40acc..986b3acf6b0 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -323,7 +323,8 @@ static void extern_local_image(Image *UNUSED(ima)) match id_make_local pattern. */ } -void make_local_image(struct Image *ima) { +void make_local_image(struct Image *ima) +{ Main *bmain= G.main; Tex *tex; Brush *brush; @@ -339,9 +340,9 @@ void make_local_image(struct Image *ima) { /* Can't take short cut here: must check meshes at least because of bogus texface ID refs. - z0r */ -#if(0) +#if 0 if(ima->id.us==1) { - id_clear_lib_data(&bmain->image, (ID *)ima); + id_clear_lib_data(bmain, (ID *)ima); extern_local_image(ima); return; } @@ -380,16 +381,17 @@ void make_local_image(struct Image *ima) { } if(local && lib==0) { - id_clear_lib_data(&bmain->image, (ID *)ima); + id_clear_lib_data(bmain, (ID *)ima); extern_local_image(ima); } else if(local && lib) { Image *iman= copy_image(ima); + char *user_data[2]= {bmain->name, iman->id.lib->filepath}; + iman->id.us= 0; /* Remap paths of new ID using old library as base. */ - bpath_traverse_id((ID *)iman, bpath_relocate_visitor, - ((ID *)ima)->lib->filepath); + bpath_traverse_id(&iman->id, bpath_relocate_visitor, user_data); tex= bmain->tex.first; while(tex) { diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index ebf5492625b..d90cda19ea9 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -255,7 +255,7 @@ void make_local_lattice(Lattice *lt) if(lt->id.lib==NULL) return; if(lt->id.us==1) { - id_clear_lib_data(&bmain->latt, (ID *)lt); + id_clear_lib_data(bmain, (ID *)lt); return; } @@ -267,7 +267,7 @@ void make_local_lattice(Lattice *lt) } if(local && lib==0) { - id_clear_lib_data(&bmain->latt, (ID *)lt); + id_clear_lib_data(bmain, (ID *)lt); } else if(local && lib) { Lattice *ltn= copy_lattice(lt); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 0c2ca4c68b3..308fa828271 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1250,12 +1250,13 @@ int new_id(ListBase *lb, ID *id, const char *tname) /* 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(ListBase *lb, ID *id) +void id_clear_lib_data(Main *bmain, ID *id) { - bpath_traverse_id(id, bpath_relocate_visitor, id->lib->filepath); + char *user_data[2]= {bmain->name, id->lib->filepath}; + bpath_traverse_id(id, bpath_relocate_visitor, user_data); id->lib= NULL; id->flag= LIB_LOCAL; - new_id(lb, id, NULL); + new_id(which_libbase(bmain, GS(id->name)), id, NULL); } /* next to indirect usage in read/writefile also in editobject.c scene.c */ diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 12d92d57e86..4fd2c3ff2fc 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -297,7 +297,7 @@ void make_local_material(Material *ma) /* One local user; set flag and return. */ if(ma->id.us==1) { - id_clear_lib_data(&bmain->mat, (ID *)ma); + id_clear_lib_data(bmain, (ID *)ma); extern_local_material(ma); return; } @@ -359,7 +359,7 @@ void make_local_material(Material *ma) /* Only local users. */ if(local && lib==0) { - id_clear_lib_data(&bmain->mat, (ID *)ma); + id_clear_lib_data(bmain, (ID *)ma); extern_local_material(ma); } /* Both user and local, so copy. */ diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 2c6a3b80d94..db493b33ced 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -156,7 +156,7 @@ void make_local_mball(MetaBall *mb) if(mb->id.lib==NULL) return; if(mb->id.us==1) { - id_clear_lib_data(&bmain->mball, (ID *)mb); + id_clear_lib_data(bmain, (ID *)mb); extern_local_mball(mb); return; @@ -170,7 +170,7 @@ void make_local_mball(MetaBall *mb) } if(local && lib==0) { - id_clear_lib_data(&bmain->mball, (ID *)mb); + id_clear_lib_data(bmain, (ID *)mb); extern_local_mball(mb); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a5bf39d895c..5c7d9278783 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -280,7 +280,7 @@ void make_local_mesh(Mesh *me) if(me->id.lib==NULL) return; if(me->id.us==1) { - id_clear_lib_data(&bmain->mesh, (ID *)me); + id_clear_lib_data(bmain, (ID *)me); expand_local_mesh(me); return; } @@ -293,7 +293,7 @@ void make_local_mesh(Mesh *me) } if(local && lib==0) { - id_clear_lib_data(&bmain->mesh, (ID *)me); + id_clear_lib_data(bmain, (ID *)me); expand_local_mesh(me); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 6a3e0353a07..824e59a82c5 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1050,7 +1050,7 @@ void ntreeMakeLocal(bNodeTree *ntree) if(ntree->id.lib==NULL) return; if(ntree->id.us==1) { - id_clear_lib_data(&bmain->nodetree, (ID *)ntree); + id_clear_lib_data(bmain, (ID *)ntree); return; } @@ -1064,7 +1064,7 @@ void ntreeMakeLocal(bNodeTree *ntree) /* if all users are local, we simply make tree local */ if(cd.local && cd.lib==0) { - id_clear_lib_data(&bmain->nodetree, (ID *)ntree); + 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 6e09aefeea2..819a98248f9 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -756,7 +756,7 @@ void make_local_camera(Camera *cam) if(cam->id.lib==NULL) return; if(cam->id.us==1) { - id_clear_lib_data(&bmain->camera, (ID *)cam); + id_clear_lib_data(bmain, (ID *)cam); return; } @@ -768,7 +768,7 @@ void make_local_camera(Camera *cam) } if(local && lib==0) { - id_clear_lib_data(&bmain->camera, (ID *)cam); + id_clear_lib_data(bmain, (ID *)cam); } else if(local && lib) { Camera *camn= copy_camera(cam); @@ -917,7 +917,7 @@ void make_local_lamp(Lamp *la) if(la->id.lib==NULL) return; if(la->id.us==1) { - id_clear_lib_data(&bmain->lamp, (ID *)la); + id_clear_lib_data(bmain, (ID *)la); return; } @@ -931,7 +931,7 @@ void make_local_lamp(Lamp *la) } if(local && lib==0) { - id_clear_lib_data(&bmain->lamp, (ID *)la); + id_clear_lib_data(bmain, (ID *)la); } else if(local && lib) { lan= copy_lamp(la); @@ -1083,7 +1083,6 @@ Object *add_only_object(int type, const char *name) /* ob->pad3 == Contact Processing Threshold */ ob->m_contactProcessingThreshold = 1.; ob->obstacleRad = 1.; - ob->col_group = ob->col_mask = 1; /* NT fluid sim defaults */ ob->fluidsimFlag = 0; @@ -1461,7 +1460,7 @@ void make_local_object(Object *ob) ob->proxy= ob->proxy_from= NULL; if(ob->id.us==1) { - id_clear_lib_data(&bmain->object, (ID *)ob); + id_clear_lib_data(bmain, (ID *)ob); extern_local_object(ob); } else { @@ -1473,7 +1472,7 @@ void make_local_object(Object *ob) } if(local && lib==0) { - id_clear_lib_data(&bmain->object, (ID *)ob); + id_clear_lib_data(bmain, (ID *)ob); extern_local_object(ob); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f478c8faf07..99d7a9af512 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3610,7 +3610,7 @@ void make_local_particlesettings(ParticleSettings *part) if(part->id.lib==0) return; if(part->id.us==1) { - id_clear_lib_data(&bmain->particle, (ID *)part); + id_clear_lib_data(bmain, (ID *)part); expand_local_particlesettings(part); return; } @@ -3627,7 +3627,7 @@ void make_local_particlesettings(ParticleSettings *part) } if(local && lib==0) { - id_clear_lib_data(&bmain->particle, (ID *)part); + id_clear_lib_data(bmain, (ID *)part); expand_local_particlesettings(part); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index fb6a473f04d..a01e2eae96e 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -87,7 +87,7 @@ void make_local_speaker(Speaker *spk) if(spk->id.lib==NULL) return; if(spk->id.us==1) { - id_clear_lib_data(&bmain->speaker, (ID *)spk); + id_clear_lib_data(bmain, (ID *)spk); return; } @@ -101,7 +101,7 @@ void make_local_speaker(Speaker *spk) } if(local && lib==0) { - id_clear_lib_data(&bmain->speaker, (ID *)spk); + id_clear_lib_data(bmain, (ID *)spk); } else if(local && lib) { Speaker *spkn= copy_speaker(spk); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index b7fc2835f63..bf4cd84f571 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -814,7 +814,8 @@ Tex *localize_texture(Tex *tex) /* ------------------------------------------------------------------------- */ -static void extern_local_texture(Tex *tex) { +static void extern_local_texture(Tex *tex) +{ id_lib_extern((ID *)tex->ima); } @@ -837,7 +838,7 @@ void make_local_texture(Tex *tex) if(tex->id.lib==NULL) return; if(tex->id.us==1) { - id_clear_lib_data(&bmain->tex, (ID *)tex); + id_clear_lib_data(bmain, (ID *)tex); extern_local_texture(tex); return; } @@ -892,7 +893,7 @@ void make_local_texture(Tex *tex) } if(local && lib==0) { - id_clear_lib_data(&bmain->tex, (ID *)tex); + id_clear_lib_data(bmain, (ID *)tex); extern_local_texture(tex); } else if(local && lib) { diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 150bf7157d9..ca719e58ea9 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -160,7 +160,7 @@ void make_local_world(World *wrld) if(wrld->id.lib==NULL) return; if(wrld->id.us==1) { - id_clear_lib_data(&bmain->world, (ID *)wrld); + id_clear_lib_data(bmain, (ID *)wrld); return; } @@ -172,7 +172,7 @@ void make_local_world(World *wrld) } if(local && lib==0) { - id_clear_lib_data(&bmain->world, (ID *)wrld); + id_clear_lib_data(bmain, (ID *)wrld); } else if(local && lib) { World *wrldn= copy_world(wrld); -- cgit v1.2.3 From 92fe279fe6903764215f21fab1e40447032056e2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Oct 2011 21:30:08 +0000 Subject: quiet -Wempty-body and unused warnings --- source/blender/blenkernel/intern/particle_system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index c28bbfa0554..f904f246b65 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3853,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); -- cgit v1.2.3 From 5afc38b74c73188f8a38d8f5d7af7cb21e203179 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Oct 2011 22:46:06 +0000 Subject: Support more kinds of paths for path re-writing / traversing, patch from Alex Fraser with additions. this now supports as many types as bpath iterator which its intended to replace. --- source/blender/blenkernel/intern/library.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 308fa828271..f6a5a7f9427 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1477,7 +1477,12 @@ void name_uiprefix_id(char *name, ID *id) void BKE_library_filepath_set(Library *lib, const char *filepath) { - BLI_strncpy(lib->name, filepath, sizeof(lib->name)); + /* 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 -- cgit v1.2.3 From cd852ce1a199da11f119394ea719f9699c76c995 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 01:25:07 +0000 Subject: - remove bpath iterator and replace all uses with visitor. - added flag to optionally receive all paths as absolute. --- source/blender/blenkernel/intern/blender.c | 19 ++++++++----------- source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/library.c | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 4cbdbeb890d..6e343e874f1 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -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/image.c b/source/blender/blenkernel/intern/image.c index 986b3acf6b0..d60d32a4a51 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -391,7 +391,7 @@ void make_local_image(struct Image *ima) iman->id.us= 0; /* Remap paths of new ID using old library as base. */ - bpath_traverse_id(&iman->id, bpath_relocate_visitor, user_data); + bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, user_data); tex= bmain->tex.first; while(tex) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index f6a5a7f9427..be495a7882f 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1253,7 +1253,7 @@ int new_id(ListBase *lb, ID *id, const char *tname) void id_clear_lib_data(Main *bmain, ID *id) { char *user_data[2]= {bmain->name, id->lib->filepath}; - bpath_traverse_id(id, bpath_relocate_visitor, user_data); + bpath_traverse_id(bmain, id, bpath_relocate_visitor, 0, user_data); id->lib= NULL; id->flag= LIB_LOCAL; new_id(which_libbase(bmain, GS(id->name)), id, NULL); -- cgit v1.2.3 From fa6e6e7fc0977248e7ac10dddc79499304f05bda Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 04:24:34 +0000 Subject: pass image description to image loading functions for more useful error than 'Unknown fileformat'. --- source/blender/blenkernel/intern/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d60d32a4a51..ee0f1177fce 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1948,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, ""); } else { flag= IB_rect|IB_multilayer|IB_metadata; -- cgit v1.2.3 From f7d5cea669bd40de9c0aa5fc3aaa4c7f49f697a8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 05:34:39 +0000 Subject: use path remapping for all make local functions, patch from Alex Fraser with changes. --- source/blender/blenkernel/intern/action.c | 28 ++++++------ source/blender/blenkernel/intern/armature.c | 23 ++++++---- source/blender/blenkernel/intern/brush.c | 21 +++++---- source/blender/blenkernel/intern/curve.c | 22 ++++++---- source/blender/blenkernel/intern/image.c | 26 +++++------ source/blender/blenkernel/intern/key.c | 2 +- source/blender/blenkernel/intern/lattice.c | 21 +++++---- source/blender/blenkernel/intern/library.c | 4 +- source/blender/blenkernel/intern/material.c | 38 ++++++++-------- source/blender/blenkernel/intern/mball.c | 22 ++++++---- source/blender/blenkernel/intern/mesh.c | 22 ++++++---- source/blender/blenkernel/intern/object.c | 67 ++++++++++++++++++----------- source/blender/blenkernel/intern/particle.c | 24 +++++++---- source/blender/blenkernel/intern/speaker.c | 20 ++++++--- source/blender/blenkernel/intern/texture.c | 39 +++++++++-------- source/blender/blenkernel/intern/world.c | 23 ++++++---- 16 files changed, 239 insertions(+), 163 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d02a1d6dd27..8e9d5ee34a8 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -43,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" @@ -94,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 */ @@ -104,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; } } @@ -129,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) @@ -137,19 +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)) { - id_clear_lib_data(bmain, (ID *)act); + id_clear_lib_data(bmain, &act->id); return; } BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac); - if (mlac.local && mlac.lib==0) { - id_clear_lib_data(bmain, (ID *)act); + 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); } } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b4b5dfedad2..2ebede13d70 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -136,29 +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) { - id_clear_lib_data(bmain, (ID *)arm); + 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) { - id_clear_lib_data(bmain, (ID *)arm); + 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) { diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 511f90f3d26..10f056e9b78 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -45,6 +45,7 @@ #include "RNA_access.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_rand.h" @@ -194,26 +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. Clone image should only have one user anyway. */ - id_clear_lib_data(bmain, (ID *)brush->clone.image); + 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) { - id_clear_lib_data(bmain, (ID *)brush); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &brush->id); extern_local_brush(brush); /* enable fake user by default */ @@ -222,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/curve.c b/source/blender/blenkernel/intern/curve.c index f5335bb12cd..3f014f241ff 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_bpath.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -245,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 @@ -255,26 +256,31 @@ void make_local_curve(Curve *cu) if(cu->id.lib==NULL) return; if(cu->id.us==1) { - id_clear_lib_data(bmain, (ID *)cu); + 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) { - id_clear_lib_data(bmain, (ID *)cu); + 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) { diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ee0f1177fce..d88cbc33926 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -329,7 +329,7 @@ void make_local_image(struct Image *ima) Tex *tex; Brush *brush; Mesh *me; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -342,7 +342,7 @@ void make_local_image(struct Image *ima) texface ID refs. - z0r */ #if 0 if(ima->id.us==1) { - id_clear_lib_data(bmain, (ID *)ima); + id_clear_lib_data(bmain, &ima->id); extern_local_image(ima); return; } @@ -350,14 +350,14 @@ void make_local_image(struct Image *ima) for(tex= bmain->tex.first; tex; tex= tex->id.next) { if(tex->ima == ima) { - if(tex->id.lib) lib= 1; - else local= 1; + 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) lib= 1; - else local= 1; + if(brush->id.lib) is_lib= TRUE; + else is_local= TRUE; } } for(me= bmain->mesh.first; me; me= me->id.next) { @@ -371,8 +371,8 @@ void make_local_image(struct Image *ima) for(a=0; atotface; a++, tface++) { if(tface->tpage == ima) { - if(me->id.lib) lib=1; - else local= 1; + if(me->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } @@ -380,18 +380,18 @@ void make_local_image(struct Image *ima) } } - if(local && lib==0) { - id_clear_lib_data(bmain, (ID *)ima); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &ima->id); extern_local_image(ima); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, ima->id.lib->filepath}; Image *iman= copy_image(ima); - char *user_data[2]= {bmain->name, iman->id.lib->filepath}; iman->id.us= 0; /* Remap paths of new ID using old library as base. */ - bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, user_data); + bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, bpath_user_data); tex= bmain->tex.first; while(tex) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 5ac8780e4a2..5fbe1ca3a23 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -181,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 diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index d90cda19ea9..9a528b54143 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -39,6 +39,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_bpath.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -246,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 @@ -255,24 +256,28 @@ void make_local_lattice(Lattice *lt) if(lt->id.lib==NULL) return; if(lt->id.us==1) { - id_clear_lib_data(bmain, (ID *)lt); + 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) { - id_clear_lib_data(bmain, (ID *)lt); + 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 be495a7882f..d94e6f844a9 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1252,8 +1252,8 @@ int new_id(ListBase *lb, ID *id, const char *tname) don't have other library users. */ void id_clear_lib_data(Main *bmain, ID *id) { - char *user_data[2]= {bmain->name, id->lib->filepath}; - bpath_traverse_id(bmain, id, bpath_relocate_visitor, 0, user_data); + 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); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 4fd2c3ff2fc..2ad3da9f3a0 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -50,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" @@ -285,8 +286,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,7 +297,7 @@ void make_local_material(Material *ma) /* One local user; set flag and return. */ if(ma->id.us==1) { - id_clear_lib_data(bmain, (ID *)ma); + id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); return; } @@ -310,8 +310,8 @@ void make_local_material(Material *ma) if(ob->mat) { for(a=0; atotcol; 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; } } } @@ -323,8 +323,8 @@ void make_local_material(Material *ma) if(me->mat) { for(a=0; atotcol; 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; } } } @@ -336,8 +336,8 @@ void make_local_material(Material *ma) if(cu->mat) { for(a=0; atotcol; 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; } } } @@ -349,8 +349,8 @@ void make_local_material(Material *ma) if(mb->mat) { for(a=0; atotcol; 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; } } } @@ -358,16 +358,20 @@ void make_local_material(Material *ma) } /* Only local users. */ - if(local && lib==0) { - id_clear_lib_data(bmain, (ID *)ma); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); } /* Both user and local, so copy. */ - else if(local && lib) { - - man= copy_material(ma); + 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 db493b33ced..98646bd2faa 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -50,7 +50,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" - +#include "BLI_bpath.h" #include "BKE_global.h" @@ -147,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 @@ -156,27 +156,31 @@ void make_local_mball(MetaBall *mb) if(mb->id.lib==NULL) return; if(mb->id.us==1) { - id_clear_lib_data(bmain, (ID *)mb); + 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) { - id_clear_lib_data(bmain, (ID *)mb); + 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 5c7d9278783..50525c2b9cd 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -43,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" @@ -271,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 @@ -280,26 +281,31 @@ void make_local_mesh(Mesh *me) if(me->id.lib==NULL) return; if(me->id.us==1) { - id_clear_lib_data(bmain, (ID *)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) { - id_clear_lib_data(bmain, (ID *)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/object.c b/source/blender/blenkernel/intern/object.c index 819a98248f9..e1a428ce242 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -56,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" @@ -747,7 +748,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 @@ -756,24 +757,29 @@ void make_local_camera(Camera *cam) if(cam->id.lib==NULL) return; if(cam->id.us==1) { - id_clear_lib_data(bmain, (ID *)cam); + 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) { - id_clear_lib_data(bmain, (ID *)cam); + 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) { @@ -907,8 +913,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 @@ -917,26 +922,31 @@ void make_local_lamp(Lamp *la) if(la->id.lib==NULL) return; if(la->id.us==1) { - id_clear_lib_data(bmain, (ID *)la); + 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) { - id_clear_lib_data(bmain, (ID *)la); + 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) { @@ -1448,7 +1458,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 @@ -1460,25 +1470,30 @@ void make_local_object(Object *ob) ob->proxy= ob->proxy_from= NULL; if(ob->id.us==1) { - id_clear_lib_data(bmain, (ID *)ob); + 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) { - id_clear_lib_data(bmain, (ID *)ob); + 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) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 99d7a9af512..a1ed0862336 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -53,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" @@ -3601,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 @@ -3610,30 +3611,35 @@ void make_local_particlesettings(ParticleSettings *part) if(part->id.lib==0) return; if(part->id.us==1) { - id_clear_lib_data(bmain, (ID *)part); + 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) { - id_clear_lib_data(bmain, (ID *)part); + 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/speaker.c b/source/blender/blenkernel/intern/speaker.c index a01e2eae96e..d5788d7a748 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -34,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" @@ -78,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 @@ -87,26 +89,30 @@ void make_local_speaker(Speaker *spk) if(spk->id.lib==NULL) return; if(spk->id.us==1) { - id_clear_lib_data(bmain, (ID *)spk); + 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) { - id_clear_lib_data(bmain, (ID *)spk); + 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/texture.c b/source/blender/blenkernel/intern/texture.c index bf4cd84f571..e3713b1e177 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -42,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" @@ -822,13 +823,12 @@ static void extern_local_texture(Tex *tex) 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 @@ -838,7 +838,7 @@ void make_local_texture(Tex *tex) if(tex->id.lib==NULL) return; if(tex->id.us==1) { - id_clear_lib_data(bmain, (ID *)tex); + id_clear_lib_data(bmain, &tex->id); extern_local_texture(tex); return; } @@ -847,8 +847,8 @@ void make_local_texture(Tex *tex) while(ma) { for(a=0; amtex[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; @@ -857,8 +857,8 @@ void make_local_texture(Tex *tex) while(la) { for(a=0; amtex[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; @@ -867,8 +867,8 @@ void make_local_texture(Tex *tex) while(wrld) { for(a=0; amtex[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; @@ -876,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; } @@ -885,20 +885,25 @@ void make_local_texture(Tex *tex) while(pa) { for(a=0; amtex[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) { - id_clear_lib_data(bmain, (ID *)tex); + 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/world.c b/source/blender/blenkernel/intern/world.c index ca719e58ea9..4d7a7c9a262 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -40,6 +40,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_world.h" #include "BKE_library.h" @@ -151,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 @@ -160,24 +161,28 @@ void make_local_world(World *wrld) if(wrld->id.lib==NULL) return; if(wrld->id.us==1) { - id_clear_lib_data(bmain, (ID *)wrld); + 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) { - id_clear_lib_data(bmain, (ID *)wrld); + 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) { -- cgit v1.2.3 From 99075b35ed3e5f42f4e652f68b9a5612b54c4cde Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 07:54:32 +0000 Subject: fix [#29044] applying mirror modifier causes crash; something with vertex groups? --- source/blender/blenkernel/BKE_deform.h | 6 +++--- source/blender/blenkernel/intern/deform.c | 34 +++++++++++++++++-------------- 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 15d3c86c315..84a6517fd52 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -44,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); @@ -57,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/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 0f6828cc358..b8f5d79ea0d 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -114,18 +114,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; + } } } } @@ -163,14 +165,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; itotweight; dw++, i++) - if(flip_map[dw->def_nr] >= 0) + for(dw= dvert->dw, i=0; itotweight; dw++, i++) { + if((dw->def_nr < flip_map_len) && (flip_map[dw->def_nr] >= 0)) { dw->def_nr= flip_map[dw->def_nr]; + } + } } @@ -250,17 +254,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)); -- cgit v1.2.3 From 76d2e76aec23faf737d107473888a533691b68b1 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Thu, 27 Oct 2011 12:28:39 +0000 Subject: Fix windows build (__func__ macro needs definition from BLI_utildefines.h on MSVC) --- source/blender/blenkernel/intern/deform.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index b8f5d79ea0d..943944ec3c2 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -42,6 +42,7 @@ #include "BKE_deform.h" #include "BLI_blenlib.h" +#include "bli_utildefines.h" void defgroup_copy_list (ListBase *outbase, ListBase *inbase) -- cgit v1.2.3 From 626f73718631a641fe2d9fe6e2786fc48a341ff7 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Thu, 27 Oct 2011 12:37:14 +0000 Subject: ..and now fix linux build since my windows build fix had a lowercase typo --- source/blender/blenkernel/intern/deform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 943944ec3c2..a9610023775 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -42,7 +42,7 @@ #include "BKE_deform.h" #include "BLI_blenlib.h" -#include "bli_utildefines.h" +#include "BLI_utildefines.h" void defgroup_copy_list (ListBase *outbase, ListBase *inbase) -- cgit v1.2.3 From 699030ceb698f827fe582bf03a78a44ffc283629 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 14:41:26 +0000 Subject: use const for readonly strings and set some functions to static --- source/blender/blenkernel/BKE_image.h | 2 +- source/blender/blenkernel/intern/image.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index c7e269a3b75..adb34f4c501 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -58,7 +58,7 @@ 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); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d88cbc33926..8bce7515695 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1500,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; -- cgit v1.2.3 From 4b635d16316d12dd4c57e1dcf99092551e6bbe35 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Oct 2011 04:44:59 +0000 Subject: use generic path remapping when making all library data local, previously only image paths were getting corrected, now all paths will (scene image seq strips, pointcache etc) --- source/blender/blenkernel/BKE_library.h | 2 +- source/blender/blenkernel/intern/library.c | 34 +++++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 59ced28d53e..e2033915caa 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -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/intern/library.c b/source/blender/blenkernel/intern/library.c index d94e6f844a9..9d8acc44e88 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1277,16 +1277,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) @@ -1361,14 +1351,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; @@ -1385,17 +1376,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; @@ -1410,7 +1400,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); -- cgit v1.2.3 From 0d63bb005ff7c45ca0ebcfbe4eaf1215dfe2d3e2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Oct 2011 12:40:15 +0000 Subject: replace VECCOPY and QUATCOPY with inline funcs. --- source/blender/blenkernel/intern/action.c | 28 +++++------ source/blender/blenkernel/intern/anim.c | 24 ++++----- source/blender/blenkernel/intern/armature.c | 76 ++++++++++++++--------------- source/blender/blenkernel/intern/curve.c | 60 +++++++++++------------ source/blender/blenkernel/intern/fcurve.c | 20 ++++---- source/blender/blenkernel/intern/key.c | 26 +++++----- source/blender/blenkernel/intern/object.c | 10 ++-- 7 files changed, 122 insertions(+), 122 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 8e9d5ee34a8..2a1794fe2fc 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -647,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); @@ -681,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; @@ -1118,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 716f3ed2726..2ef13318af4 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -363,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 */ @@ -374,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]); } } } @@ -654,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) @@ -842,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) { @@ -867,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]; @@ -1119,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); @@ -1378,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; } @@ -1426,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 */ @@ -1546,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/armature.c b/source/blender/blenkernel/intern/armature.c index 2ebede13d70..9fba18dd7cf 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -390,11 +390,11 @@ static void equalize_bezier(float *data, int desired) pdist[0]= 0.0f; for(a=0, fp= data; asegments elements */ @@ -488,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) { @@ -527,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); @@ -575,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 */ @@ -737,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); @@ -782,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) @@ -1019,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); @@ -1115,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 @@ -1194,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() */ @@ -1403,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; @@ -1413,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 */ @@ -1849,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 */ { @@ -1894,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; @@ -1918,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 */ @@ -2011,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 @@ -2019,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); @@ -2109,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); } } @@ -2195,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) { @@ -2250,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); } @@ -2284,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; @@ -2362,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 @@ -2379,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); } @@ -2416,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/curve.c b/source/blender/blenkernel/intern/curve.c index 3f014f241ff..13b1da22449 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1229,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]; @@ -1258,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]; @@ -1519,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 */ @@ -1690,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) @@ -1791,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 */ @@ -1804,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); @@ -1866,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); } } @@ -1975,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--) { @@ -2035,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); } @@ -2106,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; @@ -2139,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; @@ -2191,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; @@ -3011,15 +3011,15 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] BezTriple *bezt = nu->bezt; for (i=0; ipntsu; 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; ipntsu*nu->pntsv; i++,bp++) { - VECCOPY(co, bp->vec); co+=3; + copy_v3_v3(co, bp->vec); co+=3; } } } @@ -3038,15 +3038,15 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3] BezTriple *bezt = nu->bezt; for (i=0; ipntsu; 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; ipntsu*nu->pntsv; i++,bp++) { - VECCOPY(bp->vec, co); co+=3; + copy_v3_v3(bp->vec, co); co+=3; } } } @@ -3064,9 +3064,9 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] BezTriple *bezt = nu->bezt; for (i=0; ipntsu; 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 */ } } @@ -3074,7 +3074,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] BPoint *bp = nu->bp; for(i=0; ipntsu*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/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 3529b7b9e6d..474b3a5ce63 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1178,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); } } @@ -1203,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 @@ -1262,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; } @@ -1289,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/key.c b/source/blender/blenkernel/intern/key.c index 5fbe1ca3a23..0a467142f74 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -505,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; @@ -1568,7 +1568,7 @@ void latt_to_key(Lattice *lt, KeyBlock *kb) bp= lt->def; fp= kb->data; for(a=0; atotelem; a++, fp+=3, bp++) { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); } } @@ -1585,7 +1585,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt) tot= MIN2(kb->totelem, tot); for(a=0; avec, fp); + copy_v3_v3(bp->vec, fp); } } @@ -1615,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 */ @@ -1630,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; @@ -1662,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 */ @@ -1679,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; @@ -1708,7 +1708,7 @@ void mesh_to_key(Mesh *me, KeyBlock *kb) mvert= me->mvert; fp= kb->data; for(a=0; atotelem; a++, fp+=3, mvert++) { - VECCOPY(fp, mvert->co); + copy_v3_v3(fp, mvert->co); } } @@ -1725,7 +1725,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me) tot= MIN2(kb->totelem, me->totvert); for(a=0; aco, fp); + copy_v3_v3(mvert->co, fp); } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e1a428ce242..0d0552cf3b3 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2033,7 +2033,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++; @@ -2101,7 +2101,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); @@ -2225,7 +2225,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); @@ -2259,10 +2259,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]); } } -- cgit v1.2.3 From f837b46a2b561293660a0edf9d4de5ff16922f42 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 29 Oct 2011 23:56:07 +0000 Subject: Modifier compilation tweaks (Blender conference commit) * Fluid compilation: Inverse the compile flag from DISABLE_ELBEEM to WITH_MOD_FLUID for consistency. (scons/cmake) * Use WITH_BF_FLUID in your user config (scons) * Add support for scons to disable build with Decimate and Boolean modifier. (WITH_BF_DECIMATE and WITH_BF_BOOLEAN) --- source/blender/blenkernel/CMakeLists.txt | 4 ++-- source/blender/blenkernel/SConscript | 4 ++-- source/blender/blenkernel/intern/effect.c | 4 ++-- source/blender/blenkernel/intern/particle_system.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 1930e7223f9..1b98dd914aa 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -323,8 +323,8 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -if(NOT WITH_MOD_FLUID) - add_definitions(-DDISABLE_ELBEEM) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_MOD_SMOKE) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 512eec4021f..ebb09352a55 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -79,8 +79,8 @@ if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_OPENMP']: defs.append('PARALLEL=1') -if env['BF_NO_ELBEEM']: - defs.append('DISABLE_ELBEEM') +if env['WITH_BF_FLUID']: + defs.append('WITH_MOD_FLUID') if env['WITH_BF_LZO']: incs += ' #/extern/lzo/minilzo' diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index c4543df0d16..bb14a1ddeaf 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -91,12 +91,12 @@ #include "RE_shader_ext.h" /* fluid sim particle import */ -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID #include "DNA_object_fluidsim.h" #include "LBM_fluidsim.h" #include #include -#endif // DISABLE_ELBEEM +#endif // WITH_MOD_FLUID //XXX #include "BIF_screen.h" diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f904f246b65..ec058b23050 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -95,13 +95,13 @@ #include "RE_shader_ext.h" /* fluid sim particle import */ -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID #include "DNA_object_fluidsim.h" #include "LBM_fluidsim.h" #include #include -#endif // DISABLE_ELBEEM +#endif // WITH_MOD_FLUID /************************************************/ /* Reacting to system events */ @@ -3916,7 +3916,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } /* fluid sim particle import handling, actual loading of particles from file */ - #ifndef DISABLE_ELBEEM + #ifdef WITH_MOD_FLUID { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim); @@ -4009,7 +4009,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } // fluid sim particles done } - #endif // DISABLE_ELBEEM + #endif // WITH_MOD_FLUID } static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra)) -- cgit v1.2.3 From c4fa7bf286cef44f3c6c5d93aad206869f4a1b79 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 30 Oct 2011 06:53:25 +0000 Subject: make_uv_vert_map() was looping over the texture face for not reason. --- source/blender/blenkernel/intern/mesh.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 50525c2b9cd..6f66e189dcf 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1317,7 +1317,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned UvVertMap *vmap; UvMapVert *buf; MFace *mf; - MTFace *tf; unsigned int a; int i, totuv, nverts; @@ -1325,8 +1324,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned /* generate UvMapVert array */ mf= mface; - tf= tface; - for(a=0; aflag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) totuv += (mf->v4)? 4: 3; @@ -1346,8 +1344,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned } mf= mface; - tf= tface; - for(a=0; aflag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) { nverts= (mf->v4)? 4: 3; @@ -1363,7 +1360,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned } /* sort individual uvs for each vert */ - tf= tface; for(a=0; avert[a]; UvMapVert *iterv, *v, *lastv, *next; @@ -1375,14 +1371,14 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned v->next= newvlist; newvlist= v; - uv= (tf+v->f)->uv[v->tfindex]; + uv= tface[v->f].uv[v->tfindex]; lastv= NULL; iterv= vlist; while(iterv) { next= iterv->next; - uv2= (tf+iterv->f)->uv[iterv->tfindex]; + uv2= tface[iterv->f].uv[iterv->tfindex]; sub_v2_v2v2(uvdiff, uv2, uv); -- cgit v1.2.3 From dc1b3d88b821db1316c85be5f48a60107796b651 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 31 Oct 2011 00:23:42 +0000 Subject: fix [#29098] File save dialog cannot handle extra periods in file name --- source/blender/blenkernel/intern/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8bce7515695..9aeacb9d7fa 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -981,7 +981,7 @@ int BKE_add_image_extension(char *string, int imtype) || (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) { return BLI_replace_extension(string, FILE_MAX, extension); } else { - strcat(string, extension); + return BLI_ensure_extension(string, FILE_MAX, extension); return TRUE; } -- cgit v1.2.3 From 797d2bbd8894462d19f0eda4d9bf818e477f7112 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 31 Oct 2011 06:13:20 +0000 Subject: use_verify option to defvert_sync_mapped and defvert_sync was flipped, also minor edits to defvert_verify_index() - no functional change. --- source/blender/blenkernel/intern/deform.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index a9610023775..83eda860510 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -104,8 +104,8 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif 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, dw->def_nr); - else dw_r= defvert_verify_index(dvert_r, dw->def_nr); + if(use_verify) dw_r= defvert_verify_index(dvert_r, dw->def_nr); + else dw_r= defvert_find_index(dvert_r, dw->def_nr); if(dw_r) { dw_r->weight= dw->weight; @@ -123,8 +123,8 @@ void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const 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(use_verify) dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]); + else dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]); if(dw_r) { dw_r->weight= dw->weight; @@ -487,25 +487,25 @@ MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup) MDeformWeight *newdw; /* do this check always, this function is used to check for it */ - if(!dv || defgroup<0) + if(!dv || defgroup < 0) return NULL; - newdw = defvert_find_index(dv, defgroup); + newdw= defvert_find_index(dv, defgroup); if(newdw) return newdw; - newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); - if(dv->dw) { + newdw= MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); + if (dv->dw) { memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight); MEM_freeN(dv->dw); } - dv->dw=newdw; - - dv->dw[dv->totweight].weight=0.0f; - dv->dw[dv->totweight].def_nr=defgroup; + dv->dw= newdw; + newdw += dv->totweight; + newdw->weight= 0.0f; + newdw->def_nr= defgroup; /* Group index */ dv->totweight++; - return dv->dw+(dv->totweight-1); + return newdw; } -- cgit v1.2.3 From e3f03d72b6e0a24a2c87e94c68c5f6452ad91e94 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Nov 2011 06:26:55 +0000 Subject: added path traversal flag - BPATH_TRAVERSE_SKIP_MULTIFILE, so path manipulation functions dont run multiple times on the same path in the case of sequence strips where the one directory is used as the base for many images. --- source/blender/blenkernel/BKE_library.h | 1 + source/blender/blenkernel/intern/action.c | 5 +---- source/blender/blenkernel/intern/armature.c | 3 +-- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/brush.c | 3 +-- source/blender/blenkernel/intern/curve.c | 5 +---- source/blender/blenkernel/intern/image.c | 3 +-- source/blender/blenkernel/intern/lattice.c | 3 +-- source/blender/blenkernel/intern/library.c | 19 +++++++++++++++++-- source/blender/blenkernel/intern/material.c | 3 +-- source/blender/blenkernel/intern/mball.c | 3 +-- source/blender/blenkernel/intern/mesh.c | 3 +-- source/blender/blenkernel/intern/object.c | 10 +++------- source/blender/blenkernel/intern/particle.c | 3 +-- source/blender/blenkernel/intern/speaker.c | 3 +-- source/blender/blenkernel/intern/texture.c | 3 +-- source/blender/blenkernel/intern/world.c | 3 +-- 17 files changed, 35 insertions(+), 40 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index e2033915caa..9130cac6cd6 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -49,6 +49,7 @@ void *alloc_libblock(struct ListBase *lb, short type, const char *name); void *copy_libblock(void *rt); void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action); +void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id); 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); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 2a1794fe2fc..944f7c6a0b6 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -146,13 +146,10 @@ void make_local_action(bAction *act) id_clear_lib_data(bmain, &act->id); } 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_id_lib_local_paths(bmain, &mlac.actn->id); BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac); } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 9fba18dd7cf..e9a19b50a81 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -157,12 +157,11 @@ void make_local_armature(bArmature *arm) id_clear_lib_data(bmain, &arm->id); } 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); + BKE_id_lib_local_paths(bmain, &armn->id); for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data == arm) { diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6e343e874f1..d68b0b361d1 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -172,7 +172,7 @@ static void clean_paths(Main *main) { Scene *scene; - bpath_traverse_main(main, clean_paths_visit_cb, 0, NULL); + bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL); for(scene= main->scene.first; scene; scene= scene->id.next) { BLI_clean(scene->r.pic); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 10f056e9b78..e78b89441c9 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -224,13 +224,12 @@ void make_local_brush(Brush *brush) } } 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); + BKE_id_lib_local_paths(bmain, &brush->id); 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/curve.c b/source/blender/blenkernel/intern/curve.c index 13b1da22449..5d2180fe702 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -273,13 +273,10 @@ void make_local_curve(Curve *cu) extern_local_curve(cu); } 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); + BKE_id_lib_local_paths(bmain, &cun->id); for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data==cu) { diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 9aeacb9d7fa..08440849a4e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -385,13 +385,12 @@ void make_local_image(struct Image *ima) 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); + BKE_id_lib_local_paths(bmain, &iman->id); tex= bmain->tex.first; while(tex) { diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 9a528b54143..47878242604 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -271,12 +271,11 @@ void make_local_lattice(Lattice *lt) id_clear_lib_data(bmain, <->id); } 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); + BKE_id_lib_local_paths(bmain, <n->id); for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data==lt) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 9d8acc44e88..35b50730a31 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -127,6 +127,21 @@ /* ************* general ************************ */ + +/* this has to be called from each make_local_* func, we could call + * from id_make_local() but then the make local functions would not be self + * contained. + * also note that the id _must_ have a library - campbell */ +void BKE_id_lib_local_paths(Main *bmain, ID *id) +{ + char *bpath_user_data[2]= {bmain->name, (id)->lib->filepath}; + + bpath_traverse_id(bmain, id, + bpath_relocate_visitor, + BPATH_TRAVERSE_SKIP_MULTIFILE, + bpath_user_data); +} + void id_lib_extern(ID *id) { if(id) { @@ -1252,8 +1267,8 @@ int new_id(ListBase *lb, ID *id, const char *tname) 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); + BKE_id_lib_local_paths(bmain, id); + id->lib= NULL; id->flag= LIB_LOCAL; new_id(which_libbase(bmain, GS(id->name)), id, NULL); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 2ad3da9f3a0..7be3514e0f2 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -364,13 +364,12 @@ void make_local_material(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); + BKE_id_lib_local_paths(bmain, &man->id); /* do objects */ ob= bmain->object.first; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 98646bd2faa..327306b32ee 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -174,12 +174,11 @@ void make_local_mball(MetaBall *mb) extern_local_mball(mb); } 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); + BKE_id_lib_local_paths(bmain, &mbn->id); for(ob= G.main->object.first; ob; ob= ob->id.next) { if(ob->data == mb) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6f66e189dcf..4a8bc34cdf7 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -298,13 +298,12 @@ void make_local_mesh(Mesh *me) expand_local_mesh(me); } 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); + BKE_id_lib_local_paths(bmain, &men->id); for(ob= bmain->object.first; ob; ob= ob->id.next) { if(me == ob->data) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0d0552cf3b3..635e0744aa1 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -772,13 +772,12 @@ void make_local_camera(Camera *cam) id_clear_lib_data(bmain, &cam->id); } 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); + BKE_id_lib_local_paths(bmain, &camn->id); for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data == cam) { @@ -939,13 +938,11 @@ void make_local_lamp(Lamp *la) id_clear_lib_data(bmain, &la->id); } 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); + BKE_id_lib_local_paths(bmain, &lan->id); ob= bmain->object.first; while(ob) { @@ -1486,13 +1483,12 @@ void make_local_object(Object *ob) extern_local_object(ob); } 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); + BKE_id_lib_local_paths(bmain, &obn->id); sce= bmain->scene.first; while(sce) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a1ed0862336..7678da1c7c4 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3632,13 +3632,12 @@ void make_local_particlesettings(ParticleSettings *part) expand_local_particlesettings(part); } 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); + BKE_id_lib_local_paths(bmain, &partn->id); /* do objects */ for(ob= bmain->object.first; ob; ob= ob->id.next) { diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index d5788d7a748..018c7a197ff 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -106,12 +106,11 @@ void make_local_speaker(Speaker *spk) id_clear_lib_data(bmain, &spk->id); } 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); + BKE_id_lib_local_paths(bmain, &spkn->id); ob= bmain->object.first; while(ob) { diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index e3713b1e177..d3bd7d7b766 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -897,13 +897,12 @@ void make_local_texture(Tex *tex) extern_local_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); + BKE_id_lib_local_paths(bmain, &texn->id); ma= bmain->mat.first; while(ma) { diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 4d7a7c9a262..5797c6c3f15 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -176,12 +176,11 @@ void make_local_world(World *wrld) id_clear_lib_data(bmain, &wrld->id); } 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); + BKE_id_lib_local_paths(bmain, &wrldn->id); for(sce= bmain->scene.first; sce; sce= sce->id.next) { if(sce->world == wrld) { -- cgit v1.2.3 From bcdcbb65c159cc16b222fc5381e806a6b4f03fb0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Nov 2011 06:45:36 +0000 Subject: macro to check if an object type supports vgroups --- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/blenkernel/intern/key.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c244c26ad7f..aebf3198cf4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -703,7 +703,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC ct->type = CONSTRAINT_OBTYPE_BONE; \ ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \ }\ - else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) { \ + else if (OB_TYPE_SUPPORT_VGROUP(ct->tar->type) && (ct->subtarget[0])) { \ ct->type = CONSTRAINT_OBTYPE_VERT; \ ct->rotOrder = EULER_ORDER_DEFAULT; \ } \ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 0a467142f74..6d095117136 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1381,7 +1381,7 @@ float *do_ob_key(Scene *scene, Object *ob) ob->shapenr= 1; } - if(ELEM(ob->type, OB_MESH, OB_LATTICE)) { + if (OB_TYPE_SUPPORT_VGROUP(ob->type)) { float *weights= get_weights_array(ob, kb->vgroup); cp_key(0, tot, tot, out, key, actkb, kb, weights, 0); -- cgit v1.2.3 From 2ad80bf3bb807a5d433406794becb6aaafd415f9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Nov 2011 08:11:55 +0000 Subject: vertex group mirror - now works in vertex select + weight paint mode. - added option not to mirror all vertex groups. --- source/blender/blenkernel/BKE_deform.h | 1 + source/blender/blenkernel/intern/deform.c | 42 ++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 84a6517fd52..71814799050 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -45,6 +45,7 @@ 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 *flip_map_len, int use_default); +int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, int use_default, int defgroup); 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); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 83eda860510..0c3c78f6eef 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -257,17 +257,19 @@ int defgroup_find_index (Object *ob, bDeformGroup *dg) /* note, must be freed */ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) { - bDeformGroup *dg; int totdg= *flip_map_len= BLI_countlist(&ob->defbase); if(totdg==0) { return NULL; } else { + bDeformGroup *dg; char name[sizeof(dg->name)]; int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), __func__); - memset(map, -1, totdg * sizeof(int)); + for (i=0; i < totdg; i++) { + map[i]= -1; + } for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) { if(map[i] == -1) { /* may be calculated previously */ @@ -276,7 +278,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) if(use_default) map[i]= i; - flip_side_name(name, dg->name, 0); + flip_side_name(name, dg->name, FALSE); if(strcmp(name, dg->name)) { flip_num= defgroup_name_index(ob, name); if(flip_num >= 0) { @@ -290,6 +292,40 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default) } } +/* note, must be freed */ +int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup) +{ + int totdg= *flip_map_len= BLI_countlist(&ob->defbase); + + if(totdg==0) { + return NULL; + } + else { + bDeformGroup *dg; + char name[sizeof(dg->name)]; + int i, flip_num, *map= MEM_mallocN(totdg * sizeof(int), __func__); + + for (i=0; i < totdg; i++) { + if (use_default) map[i]= i; + else map[i]= -1; + } + + dg= BLI_findlink(&ob->defbase, defgroup); + + flip_side_name(name, dg->name, FALSE); + if(strcmp(name, dg->name)) { + flip_num= defgroup_name_index(ob, name); + + if(flip_num >= 0) { + map[defgroup]= flip_num; + map[flip_num]= defgroup; + } + } + + return map; + } +} + int defgroup_flip_index(Object *ob, int index, int use_default) { bDeformGroup *dg= BLI_findlink(&ob->defbase, index); -- cgit v1.2.3 From dd8a575c22db8b6e1a78610115cf7e369f26ae0c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Nov 2011 09:47:19 +0000 Subject: correct header, for some reason gcc doesnt warn about this --- source/blender/blenkernel/BKE_deform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 71814799050..3e643fe961c 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -58,7 +58,7 @@ 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, const int flip_map_len, int use_verify); +void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify); void defvert_remap (struct MDeformVert *dvert, int *map); void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); void defvert_normalize(struct MDeformVert *dvert); -- cgit v1.2.3 From d7de4d28dd5c0042e80e5dc585b35e3808c4e0a4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Nov 2011 22:51:10 +0000 Subject: quiet some warnings. --- source/blender/blenkernel/intern/smoke.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index ac2a840c95a..7174126a00c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -77,6 +77,8 @@ #include "BKE_smoke.h" +#ifdef WITH_SMOKE + #ifdef _WIN32 #include #include @@ -131,12 +133,13 @@ struct SmokeModifierData; #define TRI_UVOFFSET (1./4.) -#ifdef WITH_SMOKE /* forward declerations */ static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); + #else /* WITH_SMOKE */ + /* Stubs to use when smoke is disabled */ struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; } struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; } @@ -146,9 +149,11 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {} long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; } void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {} + #endif /* WITH_SMOKE */ #ifdef WITH_SMOKE + static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm) { if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid) -- cgit v1.2.3 From aa363800b0826b4299bf999001d13530554f2ec1 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 2 Nov 2011 14:28:16 +0000 Subject: World Stars: * Remove remaining star color code, was unused. Marked as deprecated in DNA. --- source/blender/blenkernel/intern/ipo.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 85e00bcea06..034f4a96879 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -703,14 +703,7 @@ static const char *world_adrcodes_to_paths (int adrcode, int *array_index) return "mist.start"; case WO_MISTHI: return "mist.height"; - - /* Star Color is unused -- recommend removal */ - /* case WO_STAR_R: - *array_index= 0; return "stars.color"; - case WO_STAR_G: - *array_index= 1; return "stars.color"; - case WO_STAR_B: - *array_index= 2; return "stars.color"; */ + case WO_STAR_R: case WO_STAR_G: case WO_STAR_B: -- cgit v1.2.3