Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-09-05 02:14:14 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-09-05 02:14:14 +0400
commitb9b806e0a0d9f6a6f15b260cb750eb4267abd261 (patch)
treec8ce1b5fc4c4fdeccea36afd22c96b420f9adb7f /source/blender/blenloader/intern/readfile.c
parent42deb9558314086fbe9ed9300e5ead6b593fd776 (diff)
BGE: Removing the touch sensor and converting all touch sensors to collision sensors.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2d61ef09a02..0cd473fd74d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4367,12 +4367,8 @@ static void lib_link_object(FileData *fd, Main *main)
for (sens = ob->sensors.first; sens; sens = sens->next) {
for (a = 0; a < sens->totlinks; a++)
sens->links[a] = newglobadr(fd, sens->links[a]);
-
- if (sens->type == SENS_TOUCH) {
- bTouchSensor *ts = sens->data;
- ts->ma = newlibadr(fd, ob->id.lib, ts->ma);
- }
- else if (sens->type == SENS_MESSAGE) {
+
+ if (sens->type == SENS_MESSAGE) {
bMessageSensor *ms = sens->data;
ms->fromObject =
newlibadr(fd, ob->id.lib, ms->fromObject);
@@ -9616,6 +9612,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ bSensor *sens;
+ bTouchSensor *ts;
+ bCollisionSensor *cs;
+ Material *ma;
+
+ for (sens = ob->sensors.first; sens; sens = sens->next) {
+ if (sens->type == SENS_TOUCH) {
+ ts = sens->data;
+ cs = MEM_callocN(sizeof(bCollisionSensor), "touch -> collision sensor do_version");
+
+ if (ts->ma) {
+ ma = blo_do_versions_newlibadr(fd, ob->id.lib, ts->ma);
+ BLI_strncpy(cs->materialName, ma->id.name+2, sizeof(cs->materialName));
+ }
+
+ cs->mode = SENS_COLLISION_MATERIAL;
+
+ MEM_freeN(ts);
+
+ sens->data = cs;
+ sens->type = sens->otype = SENS_COLLISION;
+ }
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -10517,11 +10539,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
expand_doit(fd, mainvar, psys->part);
for (sens = ob->sensors.first; sens; sens = sens->next) {
- if (sens->type == SENS_TOUCH) {
- bTouchSensor *ts = sens->data;
- expand_doit(fd, mainvar, ts->ma);
- }
- else if (sens->type == SENS_MESSAGE) {
+ if (sens->type == SENS_MESSAGE) {
bMessageSensor *ms = sens->data;
expand_doit(fd, mainvar, ms->fromObject);
}