diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-06-18 10:46:49 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-06-18 10:46:49 +0400 |
commit | 2bece8dcb5104bc95149b0c40723f1dc855d6b29 (patch) | |
tree | 6bf9f626e03847e48f4b065d2765e4d0099dde64 /source/blender | |
parent | b4c123c275172eb4f8477ea90c3f68d61565483b (diff) |
BGE Patch: Add Shape Action support and update MSCV_7 project file for glew.
Shape Action are now supported in the BGE. A new type of actuator "Shape Action" is available on mesh objects. It can be combined with Action actuator on parent armature. Only relative keys are supported. All the usual action options are available: type, blending, priority, Python API. Only actions with shape channels should be specified of course, otherwise the actuator has no effect. Shape action will still work after a mesh replacement provided that the new mesh has compatible shape keys.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_key.h | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_actuator_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/buttons_logic.c | 12 |
9 files changed, 45 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index b5e34444d13..716eac81b55 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -44,6 +44,7 @@ struct bActionChannel; struct bPose; struct bPoseChannel; struct Object; +struct ID; /* Kernel prototypes */ #ifdef __cplusplus @@ -157,6 +158,10 @@ void rest_pose(struct bPose *pose); float get_action_frame(struct Object *ob, float cframe); /* map strip time to global time (frame nr) */ float get_action_frame_inv(struct Object *ob, float cframe); +/* builds a list of NlaIpoChannel with ipo values to write in datablock */ +void extract_ipochannels_from_action(ListBase *lb, struct ID *id, struct bAction *act, char *name, float ctime); +/* write values returned by extract_ipochannels_from_action, returns the number of value written */ +int execute_ipochannels(ListBase *lb); #ifdef __cplusplus }; diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index a6871aa837f..faf8692b89a 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -40,6 +40,11 @@ struct Object; struct Lattice; struct Mesh; +/* Kernel prototypes */ +#ifdef __cplusplus +extern "C" { +#endif + void free_key(struct Key *sc); struct Key *add_key(struct ID *id); struct Key *copy_key(struct Key *key); @@ -57,6 +62,12 @@ int do_ob_key(struct Object *ob); struct Key *ob_get_key(struct Object *ob); struct KeyBlock *ob_get_keyblock(struct Object *ob); struct KeyBlock *key_get_keyblock(struct Key *key, int index); +// needed for the GE +void do_rel_key(int start, int end, int tot, char *basispoin, struct Key *key, int mode); + +#ifdef __cplusplus +}; +#endif #endif diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 4860c65f06c..05f2e69fce1 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -860,7 +860,7 @@ typedef struct NlaIpoChannel { int type; } NlaIpoChannel; -static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime) +void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime) { bActionChannel *achan= get_action_channel(act, name); IpoCurve *icu; @@ -953,15 +953,18 @@ static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int } } -static void execute_ipochannels(ListBase *lb) +int execute_ipochannels(ListBase *lb) { NlaIpoChannel *nic; + int count = 0; for(nic= lb->first; nic; nic= nic->next) { if(nic->poin) { write_ipo_poin(nic->poin, nic->type, nic->val); + count++; } } + return count; } /* nla timing */ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 3b4e562a87a..dd6c7ddacd2 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -630,7 +630,7 @@ void cp_cu_key(Curve *cu, KeyBlock *kb, int start, int end) } -static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode) +void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode) { KeyBlock *kb; int *ofsp, ofs[3], elemsize, b; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 86e395b3770..92544f19721 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -411,6 +411,7 @@ void init_actuator(bActuator *act) switch(act->type) { #ifdef __NLA case ACT_ACTION: + case ACT_SHAPEACTION: act->data= MEM_callocN(sizeof(bActionActuator), "actionact"); break; #endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7d0dd9e41c1..fa7cbb06139 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2991,6 +2991,10 @@ static void lib_link_object(FileData *fd, Main *main) bActionActuator *aa= act->data; aa->act= newlibadr(fd, ob->id.lib, aa->act); } + else if(act->type==ACT_SHAPEACTION) { + bActionActuator *aa= act->data; + aa->act= newlibadr(fd, ob->id.lib, aa->act); + } else if(act->type==ACT_PROPERTY) { bPropertyActuator *pa= act->data; pa->ob= newlibadr(fd, ob->id.lib, pa->ob); @@ -8399,6 +8403,10 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) bActionActuator *aa= act->data; expand_doit(fd, mainvar, aa->act); } + else if(act->type==ACT_SHAPEACTION) { + bActionActuator *aa= act->data; + expand_doit(fd, mainvar, aa->act); + } else if(act->type==ACT_PROPERTY) { bPropertyActuator *pa= act->data; expand_doit(fd, mainvar, pa->ob); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index b4a9f225470..2595b95bbf0 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -664,6 +664,7 @@ static void write_actuators(WriteData *wd, ListBase *lb) switch(act->type) { case ACT_ACTION: + case ACT_SHAPEACTION: writestruct(wd, DATA, "bActionActuator", 1, act->data); break; case ACT_SOUND: diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index e34b376737a..a326f5b01d6 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -278,6 +278,7 @@ typedef struct FreeCamera { #define ACT_VISIBILITY 18 #define ACT_2DFILTER 19 #define ACT_PARENT 20 +#define ACT_SHAPEACTION 21 /* actuator flag */ #define ACT_SHOW 1 diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index 27caedf0cdd..59fedf04e30 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -677,6 +677,8 @@ static char *controller_pup(void) static char *actuator_name(int type) { switch (type) { + case ACT_SHAPEACTION: + return "Shape Action"; case ACT_ACTION: return "Action"; case ACT_OBJECT: @@ -732,6 +734,14 @@ static char *actuator_pup(Object *owner) "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17" "|Visibility %x18|2D Filter %x19|Parent %x20"; break; + + case OB_MESH: + return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1" + "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10" + "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17" + "|Visibility %x18|2D Filter %x19|Parent %x20"; + break; + default: return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1" "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10" @@ -1433,6 +1443,7 @@ static int get_col_actuator(int type) { switch(type) { case ACT_ACTION: return TH_BUT_ACTION; + case ACT_SHAPEACTION: return TH_BUT_ACTION; case ACT_OBJECT: return TH_BUT_NEUTRAL; case ACT_IPO: return TH_BUT_SETTING; case ACT_PROPERTY: return TH_BUT_SETTING1; @@ -1541,6 +1552,7 @@ static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, sho break; } case ACT_ACTION: + case ACT_SHAPEACTION: { /* DrawAct */ #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR |