diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-06 22:30:52 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-06 22:30:52 +0400 |
commit | e7384c9dd2d93e3814e8df51eea64f1dc687c338 (patch) | |
tree | 44fb5c808bb3af0783c675886e029e9e4bdb1a21 /source/blender/blenloader/intern | |
parent | 711306c2ba1c4ea0d0027087ce53746cde4be0ed (diff) |
Commit patch #8799: Realtime SetParent function in the BGE
This patch consists in new KX_GameObject::SetParent() and KX_GameObject::RemoveParent() functions to create and destroy parent relation during game. These functions are accessible through python and through a new actuator KX_ParentActuator. Function documentation in PyDoc.
The object keeps its orientation, position and scale when it is parented but will further rotate, move and scale with its parent from that point on. When the parent relation is broken, the object keeps the orientation, position and scale it had at that time.
The function has no effect if any of the X/Y/Z scale of the object or its new parent are below Epsilon.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 68e4978cf18..b055e62cddb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2982,6 +2982,10 @@ static void lib_link_object(FileData *fd, Main *main) bTwoDFilterActuator *_2dfa = act->data; _2dfa->text= newlibadr(fd, ob->id.lib, _2dfa->text); } + else if(act->type==ACT_PARENT) { + bParentActuator *parenta = act->data; + parenta->ob = newlibadr(fd, ob->id.lib, parenta->ob); + } act= act->next; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index afacb82ae0d..6308f092044 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -738,6 +738,9 @@ static void write_actuators(WriteData *wd, ListBase *lb) case ACT_2DFILTER: writestruct(wd, DATA, "bTwoDFilterActuator", 1, act->data); break; + case ACT_PARENT: + writestruct(wd, DATA, "bParentActuator", 1, act->data); + break; default: ; /* error: don't know how to write this file */ } |