From 37f57288cbcdb54770a8b01d74a323d62251fe9e Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 14 Sep 2004 19:03:11 +0000 Subject: Lot of code... 2 new features: 1) Curve deform http://www.blender3d.org/cms/Curve_Deform.392.0.html Works simple as expected, but keep track of the rotation axis in F7 buttons (Track X Y Z) Only Mesh deform supported now. Code changes: - centralized deformation calls in curve_modifiers() mesh_modifiers() etcetera. Here also other effects can be added like wave. Now the evaluation order is fixed, but should become optional. It also doesnt use the Displist anymore as deform-input. That latter part is unfinished yet. This code also is used for Hooks and will be needed for softbody - made convention stricter that displists are being checked on in drawobject(), this to prevent routines to make new displists recursively (like armature does). Now a freedisplist() is sufficient to signal that a new displaylist should be made. 2) Object Hooks http://www.blender3d.org/cms/Object_Hooks.391.0.html Support for Hooks is added to Mesh, Lattice, Curve and Surface objects. For Armatures this would require some more work & research. Main goal for this feature is to provide quick & simple access to the underlying geometry in Objects on Object level, supporting hierarchies and Ipos etc. --- source/blender/blenloader/intern/readfile.c | 22 +++++++++++++++++++--- source/blender/blenloader/intern/writefile.c | 8 +++++++- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8da7ff687c8..a9a5b16b462 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2122,7 +2122,7 @@ static void lib_link_object(FileData *fd, Main *main) bSensor *sens; bController *cont; bActuator *act; - + ObHook *hook; void *poin; int warn=0, a; @@ -2240,6 +2240,10 @@ static void lib_link_object(FileData *fd, Main *main) } lib_link_scriptlink(fd, &ob->id, &ob->scriptlink); + + for(hook= ob->hooks.first; hook; hook= hook->next) { + hook->parent= newlibadr(fd, ob->id.lib, hook->parent); + } } ob= ob->id.next; } @@ -2270,7 +2274,8 @@ static void direct_link_object(FileData *fd, Object *ob) bSensor *sens; bController *cont; bActuator *act; - + ObHook *hook; + ob->disp.first=ob->disp.last= 0; ob->pose= newdataadr(fd, ob->pose); @@ -2335,7 +2340,18 @@ static void direct_link_object(FileData *fd, Object *ob) act= act->next; } - ob->bb= 0; + link_list(fd, &ob->hooks); + for(hook= ob->hooks.first; hook; hook= hook->next) { + hook->indexar= newdataadr(fd, hook->indexar); + if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + int a; + for(a=0; atotindex; a++) { + SWITCH_INT(hook->indexar[a]); + } + } + } + + ob->bb= NULL; } /* ************ READ SCENE ***************** */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 94e2e804073..0bb8d378978 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -655,7 +655,8 @@ static void write_constraint_channels(WriteData *wd, ListBase *chanbase) static void write_objects(WriteData *wd, ListBase *idbase) { Object *ob; - + ObHook *hook; + ob= idbase->first; while(ob) { if(ob->id.us>0) { @@ -677,6 +678,11 @@ static void write_objects(WriteData *wd, ListBase *idbase) write_nlastrips(wd, &ob->nlastrips); writestruct(wd, DATA, "PartDeflect", 1, ob->pd); + + for(hook= ob->hooks.first; hook; hook= hook->next) { + writestruct(wd, DATA, "ObHook", 1, hook); + writedata(wd, DATA, sizeof(int)*hook->totindex, hook->indexar); + } } ob= ob->id.next; } -- cgit v1.2.3