From 71446eea573db3ac6bac5f297c0655acbeada67c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 30 Mar 2010 12:15:16 +0000 Subject: * Multiply for panorama cameras * Some cases of struct name being set where it shouldnt have been. * Spelling: wich --> which * Copy and initialize uv modifier scale, remove unneeded enum. * Ability to pin any object into the context. * Update uv window while transforming (useful when used with UVProject modifier) * Patch by Wahooney, so new template's are internal text and dont get saved over by mistake. * Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186 Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process /usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted by Jochen Schmitt. * [#21816] bpy.data.add_image has stopped working on Windows. moved to bpy.data.images.load(), missed this call. (commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch) --- source/blender/blenkernel/BKE_library.h | 2 +- source/blender/blenkernel/intern/library.c | 14 +++++++------- source/blender/blenkernel/intern/modifier.c | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 454666566dc..cb61a08f3ba 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -53,7 +53,7 @@ int id_unlink(struct ID *id, int test); int new_id(struct ListBase *lb, struct ID *id, const char *name); -struct ListBase *wich_libbase(struct Main *mainlib, short type); +struct ListBase *which_libbase(struct Main *mainlib, short type); #define MAX_LIBARRAY 40 int set_listbasepointers(struct Main *main, struct ListBase **lb); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index bea641d2140..0eaafcb67ed 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -347,7 +347,7 @@ int id_unlink(ID *id, int test) if(id->us == 0) { if(test) return 1; - lb= wich_libbase(mainlib, GS(id->name)); + lb= which_libbase(mainlib, GS(id->name)); free_libblock(lb, id); return 1; @@ -356,7 +356,7 @@ int id_unlink(ID *id, int test) return 0; } -ListBase *wich_libbase(Main *mainlib, short type) +ListBase *which_libbase(Main *mainlib, short type) { switch( type ) { case ID_SCE: @@ -658,7 +658,7 @@ void *copy_libblock(void *rt) id= rt; - lb= wich_libbase(G.main, GS(id->name)); + lb= which_libbase(G.main, GS(id->name)); idn= alloc_libblock(lb, GS(id->name), id->name+2); if(idn==NULL) { @@ -867,7 +867,7 @@ void free_main(Main *mainvar) ID *find_id(char *type, char *name) /* type: "OB" or "MA" etc */ { - ListBase *lb= wich_libbase(G.main, GS(type)); + ListBase *lb= which_libbase(G.main, GS(type)); return BLI_findstring(lb, name, offsetof(ID, name) + 2); } @@ -1175,7 +1175,7 @@ int new_id(ListBase *lb, ID *id, const char *tname) if(id->lib) return 0; /* if no libdata given, look up based on ID */ - if(lb==NULL) lb= wich_libbase(G.main, GS(id->name)); + if(lb==NULL) lb= which_libbase(G.main, GS(id->name)); /* if no name given, use name of current ID * else make a copy (tname args can be const) */ @@ -1348,7 +1348,7 @@ void test_idbutton(char *name) ID *idtest; - lb= wich_libbase(G.main, GS(name-2) ); + lb= which_libbase(G.main, GS(name-2) ); if(lb==0) return; /* search for id */ @@ -1383,7 +1383,7 @@ void rename_id(ID *id, char *name) ListBase *lb; strncpy(id->name+2, name, 21); - lb= wich_libbase(G.main, GS(id->name) ); + lb= which_libbase(G.main, GS(id->name) ); new_id(lb, id, name); } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 7dc6babba38..3777c920be5 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -3606,6 +3606,7 @@ static void uvprojectModifier_initData(ModifierData *md) umd->flags = 0; umd->num_projectors = 1; umd->aspectx = umd->aspecty = 1.0f; + umd->scalex = umd->scaley = 1.0f; } static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target) @@ -3621,6 +3622,8 @@ static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target) tumd->num_projectors = umd->num_projectors; tumd->aspectx = umd->aspectx; tumd->aspecty = umd->aspecty; + tumd->scalex = umd->scalex; + tumd->scaley = umd->scaley; } static CustomDataMask uvprojectModifier_requiredDataMask(Object *ob, ModifierData *md) @@ -3692,6 +3695,8 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, char uvname[32]; float aspx= umd->aspectx ? umd->aspectx : 1.0f; float aspy= umd->aspecty ? umd->aspecty : 1.0f; + float scax= umd->scalex ? umd->scalex : 1.0f; + float scay= umd->scaley ? umd->scaley : 1.0f; int free_uci= 0; aspect = aspx / aspy; @@ -3829,6 +3834,22 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, project_from_camera(tface->uv[2], coords[mf->v3], projectors[0].uci); if(mf->v3) project_from_camera(tface->uv[3], coords[mf->v4], projectors[0].uci); + + if(scax != 1.0f) { + tface->uv[0][0] = ((tface->uv[0][0] - 0.5f) * scax) + 0.5f; + tface->uv[1][0] = ((tface->uv[1][0] - 0.5f) * scax) + 0.5f; + tface->uv[2][0] = ((tface->uv[2][0] - 0.5f) * scax) + 0.5f; + if(mf->v3) + tface->uv[3][0] = ((tface->uv[3][0] - 0.5f) * scax) + 0.5f; + } + + if(scay != 1.0f) { + tface->uv[0][1] = ((tface->uv[0][1] - 0.5f) * scay) + 0.5f; + tface->uv[1][1] = ((tface->uv[1][1] - 0.5f) * scay) + 0.5f; + tface->uv[2][1] = ((tface->uv[2][1] - 0.5f) * scay) + 0.5f; + if(mf->v3) + tface->uv[3][1] = ((tface->uv[3][1] - 0.5f) * scay) + 0.5f; + } } else { /* apply transformed coords as UVs */ @@ -6489,7 +6510,7 @@ static DerivedMesh *screwModifier_applyModifier(ModifierData *md, Object *ob, ed_loop_flip= 1; } else { - /* not so simple to work out wich edge is higher */ + /* not so simple to work out which edge is higher */ sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co); sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co); normalize_v3(tmp_vec1); -- cgit v1.2.3