style cleanup: comment format
[blender.git] / source / gameengine / Converter / KX_ConvertActuators.cpp
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  * Convert Blender actuators for use in the GameEngine
27  */
28
29 /** \file gameengine/Converter/KX_ConvertActuators.cpp
30  *  \ingroup bgeconv
31  */
32
33 #ifdef _MSC_VER
34 #  pragma warning (disable:4786)
35 #endif
36
37 #include <math.h>
38
39 #include "MEM_guardedalloc.h"
40
41 #include "KX_BlenderSceneConverter.h"
42 #include "KX_ConvertActuators.h"
43
44 #ifdef WITH_AUDASPACE
45 #  include "AUD_C-API.h"
46 #  include "AUD_ChannelMapperFactory.h"
47 #endif
48
49 // Actuators
50 //SCA logiclibrary native logicbricks
51 #include "SCA_PropertyActuator.h"
52 #include "SCA_LogicManager.h"
53 #include "SCA_RandomActuator.h"
54 #include "SCA_2DFilterActuator.h"
55
56 // Ketsji specific logicbricks
57 #include "KX_SceneActuator.h"
58 #include "KX_IpoActuator.h"
59 #include "KX_SoundActuator.h"
60 #include "KX_ObjectActuator.h"
61 #include "KX_TrackToActuator.h"
62 #include "KX_ConstraintActuator.h"
63 #include "KX_CameraActuator.h"
64 #include "KX_GameActuator.h"
65 #include "KX_StateActuator.h"
66 #include "KX_VisibilityActuator.h"
67 #include "KX_SCA_AddObjectActuator.h"
68 #include "KX_SCA_EndObjectActuator.h"
69 #include "KX_SCA_ReplaceMeshActuator.h"
70 #include "KX_ParentActuator.h"
71 #include "KX_SCA_DynamicActuator.h"
72 #include "KX_SteeringActuator.h"
73
74 #include "KX_Scene.h"
75 #include "KX_KetsjiEngine.h"
76
77 #include "IntValue.h"
78 #include "KX_GameObject.h"
79
80 /* This little block needed for linking to Blender... */
81 #include "BKE_text.h"
82 #include "BLI_blenlib.h"
83 #include "BLI_math_base.h"
84 #include "BLI_path_util.h"
85
86 #include "KX_NetworkMessageActuator.h"
87
88 #ifdef WIN32
89 #include "BLI_winstuff.h"
90 #endif
91
92 #include "DNA_object_types.h"
93 #include "DNA_sound_types.h"
94 #include "DNA_scene_types.h"
95 #include "DNA_actuator_types.h"
96 #include "DNA_packedFile_types.h"
97 #include "BL_ActionActuator.h"
98 #include "BL_ShapeActionActuator.h"
99 #include "BL_ArmatureActuator.h"
100 #include "RNA_access.h"
101 #include "BL_Action.h"
102 /* end of blender include block */
103
104 #include "BL_BlenderDataConversion.h"
105
106 /** 
107  * KX_flt_trunc needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
108  */
109
110 BLI_INLINE float KX_flt_trunc(const float x)
111 {
112         return ( x < 0.0001f && x > -0.0001f ) ? 0.0f : x;
113 }
114
115 void BL_ConvertActuators(const char* maggiename,
116                          struct Object* blenderobject,
117                          KX_GameObject* gameobj,
118                          SCA_LogicManager* logicmgr,
119                          KX_Scene* scene,
120                          KX_KetsjiEngine* ketsjiEngine,
121                          int activeLayerBitInfo,
122                          bool isInActiveLayer,
123                          RAS_IRenderTools* rendertools,
124                          KX_BlenderSceneConverter* converter
125                          )
126 {
127         
128         int uniqueint = 0;
129         int actcount = 0;
130         int executePriority = 0;
131         bActuator* bact = (bActuator*) blenderobject->actuators.first;
132         while (bact)
133         {
134                 actcount++;
135                 bact = bact->next;
136         }
137         gameobj->ReserveActuator(actcount);
138         bact = (bActuator*) blenderobject->actuators.first;
139         while (bact)
140         {
141                 STR_String uniquename = bact->name;
142                 STR_String& objectname = gameobj->GetName();
143                 
144                 SCA_IActuator* baseact = NULL;
145                 switch (bact->type)
146                 {
147                 case ACT_OBJECT:
148                         {
149                                 bObjectActuator* obact = (bObjectActuator*) bact->data;
150                                 KX_GameObject* obref = NULL;
151                                 MT_Vector3 forcevec(KX_flt_trunc(obact->forceloc[0]),
152                                                     KX_flt_trunc(obact->forceloc[1]),
153                                                     KX_flt_trunc(obact->forceloc[2]));
154                                 MT_Vector3 torquevec(obact->forcerot[0],
155                                                      obact->forcerot[1],
156                                                      obact->forcerot[2]);
157                                 MT_Vector3 dlocvec(KX_flt_trunc(obact->dloc[0]),
158                                                    KX_flt_trunc(obact->dloc[1]),
159                                                    KX_flt_trunc(obact->dloc[2]));
160                                 MT_Vector3 drotvec(KX_flt_trunc(obact->drot[0]),
161                                                    obact->drot[1],obact->drot[2]);
162                                 MT_Vector3 linvelvec(KX_flt_trunc(obact->linearvelocity[0]),
163                                                      KX_flt_trunc(obact->linearvelocity[1]),
164                                                      KX_flt_trunc(obact->linearvelocity[2]));
165                                 MT_Vector3 angvelvec(KX_flt_trunc(obact->angularvelocity[0]),
166                                                      KX_flt_trunc(obact->angularvelocity[1]),
167                                                      KX_flt_trunc(obact->angularvelocity[2]));
168                                 short damping = obact->damping;
169
170                                 /* Blender uses a bit vector internally for the local-flags. In */
171                                 /* KX, we have four bools. The compiler should be smart enough  */
172                                 /* to do the right thing. We need to explicitly convert here!   */
173                                 
174                                 KX_LocalFlags bitLocalFlag;
175                                 
176                                 bitLocalFlag.Force = bool((obact->flag & ACT_FORCE_LOCAL)!=0);
177                                 bitLocalFlag.Torque = bool((obact->flag & ACT_TORQUE_LOCAL) !=0);//rlocal;
178                                 bitLocalFlag.DLoc = bool((obact->flag & ACT_DLOC_LOCAL)!=0);
179                                 bitLocalFlag.DRot = bool((obact->flag & ACT_DROT_LOCAL)!=0);
180                                 bitLocalFlag.LinearVelocity = bool((obact->flag & ACT_LIN_VEL_LOCAL)!=0);
181                                 bitLocalFlag.AngularVelocity = bool((obact->flag & ACT_ANG_VEL_LOCAL)!=0);
182                                 bitLocalFlag.ServoControl = bool(obact->type == ACT_OBJECT_SERVO);
183                                 bitLocalFlag.CharacterMotion = bool(obact->type == ACT_OBJECT_CHARACTER);
184                                 bitLocalFlag.CharacterJump = bool((obact->flag & ACT_CHAR_JUMP)!=0);
185                                 bitLocalFlag.AddOrSetLinV = bool((obact->flag & ACT_ADD_LIN_VEL)!=0);
186                                 bitLocalFlag.AddOrSetCharLoc = bool((obact->flag & ACT_ADD_CHAR_LOC)!=0);
187                                 if (obact->reference && bitLocalFlag.ServoControl)
188                                 {
189                                         obref = converter->FindGameObject(obact->reference);
190                                 }
191                                 
192                                 KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(
193                                             gameobj,
194                                             obref,
195                                             forcevec.getValue(),
196                                             torquevec.getValue(),
197                                             dlocvec.getValue(),
198                                             drotvec.getValue(),
199                                             linvelvec.getValue(),
200                                             angvelvec.getValue(),
201                                             damping,
202                                             bitLocalFlag);
203                                 baseact = tmpbaseact;
204                                 break;
205                         }
206                 case ACT_ACTION:
207                         {
208                                 bActionActuator* actact = (bActionActuator*) bact->data;
209                                 STR_String propname = (actact->name ? actact->name : "");
210                                 STR_String propframe = (actact->frameProp ? actact->frameProp : "");
211
212                                 short ipo_flags = 0;
213
214                                 // Convert flags
215                                 if (actact->flag & ACT_IPOFORCE) ipo_flags |= BL_Action::ACT_IPOFLAG_FORCE;
216                                 if (actact->flag & ACT_IPOLOCAL) ipo_flags |= BL_Action::ACT_IPOFLAG_LOCAL;
217                                 if (actact->flag & ACT_IPOADD) ipo_flags |= BL_Action::ACT_IPOFLAG_ADD;
218                                 if (actact->flag & ACT_IPOCHILD) ipo_flags |= BL_Action::ACT_IPOFLAG_CHILD;
219                                         
220                                 BL_ActionActuator* tmpbaseact = new BL_ActionActuator(
221                                             gameobj,
222                                             propname,
223                                             propframe,
224                                             actact->sta,
225                                             actact->end,
226                                             actact->act,
227                                             actact->type, // + 1, because Blender starts to count at zero,
228                                             actact->blendin,
229                                             actact->priority,
230                                             actact->layer,
231                                             actact->layer_weight,
232                                             ipo_flags,
233                                             actact->end_reset,
234                                             actact->stridelength
235                                             // Ketsji at 1, because zero is reserved for "NoDef"
236                                             );
237                                 baseact= tmpbaseact;
238                                 break;
239                         }
240                 case ACT_SHAPEACTION:
241                         {
242                                 if (blenderobject->type==OB_MESH) {
243                                         bActionActuator* actact = (bActionActuator*) bact->data;
244                                         STR_String propname = (actact->name ? actact->name : "");
245                                         STR_String propframe = (actact->frameProp ? actact->frameProp : "");
246                                         
247                                         BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
248                                                     gameobj,
249                                                     propname,
250                                                     propframe,
251                                                     actact->sta,
252                                                     actact->end,
253                                                     actact->act,
254                                                     actact->type, // + 1, because Blender starts to count at zero,
255                                                     actact->blendin,
256                                                     actact->priority,
257                                                     actact->stridelength);
258                                         // Ketsji at 1, because zero is reserved for "NoDef"
259                                         baseact= tmpbaseact;
260                                         break;
261                                 }
262                                 else
263                                         printf ("Discarded shape action actuator from non-mesh object [%s]\n", blenderobject->id.name+2);
264                         }
265                 case ACT_IPO:
266                         {
267                                 bIpoActuator* ipoact = (bIpoActuator*) bact->data;
268                                 bool ipochild = (ipoact->flag & ACT_IPOCHILD) !=0;
269                                 STR_String propname = ipoact->name;
270                                 STR_String frameProp = ipoact->frameProp;
271                                 // first bit?
272                                 bool ipo_as_force = (ipoact->flag & ACT_IPOFORCE);
273                                 bool local = (ipoact->flag & ACT_IPOLOCAL);
274                                 bool ipo_add = (ipoact->flag & ACT_IPOADD);
275                                 
276                                 KX_IpoActuator* tmpbaseact = new KX_IpoActuator(
277                                             gameobj,
278                                             propname ,
279                                             frameProp,
280                                             ipoact->sta,
281                                             ipoact->end,
282                                             ipochild,
283                                             ipoact->type + 1, // + 1, because Blender starts to count at zero,
284                                             // Ketsji at 1, because zero is reserved for "NoDef"
285                                             ipo_as_force,
286                                             ipo_add,
287                                             local);
288                                 baseact = tmpbaseact;
289                                 break;
290                         }
291                 case ACT_LAMP:
292                         {
293                                 break;
294                         }
295                 case ACT_CAMERA:
296                         {
297                                 bCameraActuator *camact = (bCameraActuator *) bact->data;
298                                 if (camact->ob) {
299                                         KX_GameObject *tmpgob = converter->FindGameObject(camact->ob);
300                                         
301                                         /* visifac, fac and axis are not copied from the struct...   */ 
302                                         /* that's some internal state...                             */
303                                         KX_CameraActuator *tmpcamact = new KX_CameraActuator(
304                                                     gameobj,
305                                                     tmpgob,
306                                                     camact->height,
307                                                     camact->min,
308                                                     camact->max,
309                                                     camact->axis,
310                                                     camact->damping);
311                                         baseact = tmpcamact;
312                                 }
313                                 break;
314                         }
315                 case ACT_MESSAGE:
316                         {
317                                 bMessageActuator *msgAct = (bMessageActuator *) bact->data;
318                                 
319                                 /* Get the name of the properties that objects must own that
320                                  * we're sending to, if present
321                                  */
322                                 STR_String toPropName = (msgAct->toPropName
323                                         ? (char*) msgAct->toPropName
324                                         : "");
325                                 
326                                 /* Get the Message Subject to send.
327                                  */
328                                 STR_String subject = (msgAct->subject
329                                         ? (char*) msgAct->subject
330                                         : "");
331                                 
332                                 /* Get the bodyType
333                                  */
334                                 int bodyType = msgAct->bodyType;
335                                 
336                                 /* Get the body (text message or property name whose value
337                                  * we'll be sending, might be empty
338                                  */
339                                 STR_String body = (msgAct->body
340                                         ? (char*) msgAct->body
341                                         : "");
342                                 
343                                 KX_NetworkMessageActuator *tmpmsgact = new KX_NetworkMessageActuator(
344                                             gameobj,                                    // actuator controlling object
345                                             scene->GetNetworkScene(),   // needed for replication
346                                             toPropName,
347                                             subject,
348                                             bodyType,
349                                             body);
350                                 baseact = tmpmsgact;
351                                 break;
352                         }
353                 case ACT_MATERIAL:
354                         {
355                                 break;
356                         }
357                 case ACT_SOUND:
358                         {
359                                 bSoundActuator* soundact = (bSoundActuator*) bact->data;
360                                 /* get type, and possibly a start and end frame */
361                                 KX_SoundActuator::KX_SOUNDACT_TYPE
362                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
363                                 
364                                 switch (soundact->type) {
365                                 case ACT_SND_PLAY_STOP_SOUND:
366                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP;
367                                         break;
368                                 case ACT_SND_PLAY_END_SOUND:
369                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYEND;
370                                         break;
371                                 case ACT_SND_LOOP_STOP_SOUND:
372                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPSTOP;
373                                         break;
374                                 case ACT_SND_LOOP_END_SOUND:
375                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPEND;
376                                         break;
377                                 case ACT_SND_LOOP_BIDIRECTIONAL_SOUND:
378                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL;
379                                         break;
380                                 case ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND:
381                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP;
382                                         break;
383                                         
384                                 default:
385                                         /* This is an error!!! */
386                                         soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
387                                 }
388                                 
389                                 if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF) 
390                                 {
391                                         bSound* sound = soundact->sound;
392                                         bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false;
393                                         boost::shared_ptr<AUD_IFactory> snd_sound;
394                                         KX_3DSoundSettings settings;
395                                         settings.cone_inner_angle = soundact->sound3D.cone_inner_angle;
396                                         settings.cone_outer_angle = soundact->sound3D.cone_outer_angle;
397                                         settings.cone_outer_gain = soundact->sound3D.cone_outer_gain;
398                                         settings.max_distance = soundact->sound3D.max_distance;
399                                         settings.max_gain = soundact->sound3D.max_gain;
400                                         settings.min_gain = soundact->sound3D.min_gain;
401                                         settings.reference_distance = soundact->sound3D.reference_distance;
402                                         settings.rolloff_factor = soundact->sound3D.rolloff_factor;
403
404                                         if (!sound)
405                                         {
406                                                 std::cout <<    "WARNING: Sound actuator \"" << bact->name <<
407                                                                                 "\" from object \"" <<  blenderobject->id.name+2 <<
408                                                                                 "\" has no sound datablock." << std::endl;
409                                         }
410                                         else
411                                         {
412                                                 snd_sound = *reinterpret_cast<boost::shared_ptr<AUD_IFactory>*>(sound->playback_handle);
413
414                                                 // if sound shall be 3D but isn't mono, we have to make it mono!
415                                                 if (is3d)
416                                                 {
417                                                         try
418                                                         {
419                                                                 boost::shared_ptr<AUD_IReader> reader = snd_sound->createReader();
420                                                                 if (reader->getSpecs().channels != AUD_CHANNELS_MONO)
421                                                                 {
422                                                                         AUD_DeviceSpecs specs;
423                                                                         specs.channels = AUD_CHANNELS_MONO;
424                                                                         specs.rate = AUD_RATE_INVALID;
425                                                                         specs.format = AUD_FORMAT_INVALID;
426                                                                         snd_sound = boost::shared_ptr<AUD_IFactory>(new AUD_ChannelMapperFactory(snd_sound, specs));
427                                                                 }
428                                                         }
429                                                         catch(AUD_Exception&)
430                                                         {
431                                                                 // sound cannot be played... ignore
432                                                         }
433                                                 }
434                                         }
435                                         KX_SoundActuator* tmpsoundact =
436                                                 new KX_SoundActuator(gameobj,
437                                                 snd_sound,
438                                                 soundact->volume,
439                                                 (float)(expf((soundact->pitch / 12.0f) * (float)M_LN2)),
440                                                 is3d,
441                                                 settings,
442                                                 soundActuatorType);
443
444                                         tmpsoundact->SetName(bact->name);
445                                         baseact = tmpsoundact;
446                                 }
447                                 break;
448                         }
449                 case ACT_PROPERTY:
450                         {
451                                 bPropertyActuator* propact = (bPropertyActuator*) bact->data;
452                                 SCA_IObject* destinationObj = NULL;
453                                 
454                                 /*
455                                  * here the destinationobject is searched. problem with multiple scenes: other scenes
456                                  * have not been converted yet, so the destobj will not be found, so the prop will
457                                  * not be copied.
458                                  * possible solutions:
459                                  * - convert everything when possible and not realtime only when needed.
460                                  * - let the object-with-property report itself to the act when converted
461                                  */
462                                 if (propact->ob)
463                                         destinationObj = converter->FindGameObject(propact->ob);
464                                 
465                                 SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator(
466                                             gameobj,
467                                             destinationObj,
468                                             propact->name,
469                                             propact->value,
470                                             propact->type + 1); // + 1 because Ketsji Logic starts
471                                 // with 0 for KX_ACT_PROP_NODEF
472                                 baseact = tmppropact;
473                                 break;
474                         }
475                 case ACT_EDIT_OBJECT:
476                         {
477                                 bEditObjectActuator *editobact 
478                                         = (bEditObjectActuator *) bact->data;
479                                 /* There are four different kinds of 'edit object' thingies  */
480                                 /* The alternative to this lengthy conversion is packing     */
481                                 /* several actuators in one, which is not very nice design.. */
482                                 switch (editobact->type) {
483                                 case ACT_EDOB_ADD_OBJECT: 
484                                         {
485                                                 
486                                                 // does the 'original' for replication exists, and 
487                                                 // is it in a non-active layer ?
488                                                 SCA_IObject* originalval = NULL;
489                                                 if (editobact->ob)
490                                                 {
491                                                         if (editobact->ob->lay & activeLayerBitInfo)
492                                                         {
493                                                                 fprintf(stderr, "Warning, object \"%s\" from AddObject actuator \"%s\" is not in a hidden layer.\n", objectname.Ptr(), uniquename.Ptr());
494                                                         }
495                                                         else {
496                                                                 originalval = converter->FindGameObject(editobact->ob);
497                                                         }
498                                                 }
499                                                 
500                                                 KX_SCA_AddObjectActuator* tmpaddact = new KX_SCA_AddObjectActuator(
501                                                             gameobj,
502                                                             originalval,
503                                                             editobact->time,
504                                                             scene,
505                                                             editobact->linVelocity,
506                                                             (editobact->localflag & ACT_EDOB_LOCAL_LINV) != 0,
507                                                             editobact->angVelocity,
508                                                             (editobact->localflag & ACT_EDOB_LOCAL_ANGV) != 0);
509
510                                                                 //editobact->ob to gameobj
511                                                                 baseact = tmpaddact;
512                                         }
513                                         break;
514                                 case ACT_EDOB_END_OBJECT:
515                                         {
516                                                 KX_SCA_EndObjectActuator* tmpendact 
517                                                         = new KX_SCA_EndObjectActuator(gameobj,scene);
518                                                 baseact = tmpendact;
519                                         }
520                                         break;
521                                 case ACT_EDOB_REPLACE_MESH:
522                                         {
523                                                 RAS_MeshObject *tmpmesh = NULL;
524                                                 if (editobact->me)
525                                                         tmpmesh = BL_ConvertMesh(
526                                                                     editobact->me,
527                                                                     blenderobject,
528                                                                     scene,
529                                                                     converter,
530                                                                     false
531                                                                     );
532
533                                                 KX_SCA_ReplaceMeshActuator* tmpreplaceact = new KX_SCA_ReplaceMeshActuator(
534                                                             gameobj,
535                                                             tmpmesh,
536                                                             scene,
537                                                             (editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX) == 0,
538                                                             (editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS) != 0);
539
540                                                 baseact = tmpreplaceact;
541                                         }
542                                         break;
543                                 case ACT_EDOB_TRACK_TO:
544                                         {
545                                                 SCA_IObject* originalval = NULL;
546                                                 if (editobact->ob)
547                                                         originalval = converter->FindGameObject(editobact->ob);
548                                                         
549                                                 KX_TrackToActuator* tmptrackact = new KX_TrackToActuator(
550                                                             gameobj,
551                                                             originalval,
552                                                             editobact->time,
553                                                             editobact->flag,
554                                                             blenderobject->trackflag,
555                                                             blenderobject->upflag);
556                                                 baseact = tmptrackact;
557                                                 break;
558                                         }
559                                 case ACT_EDOB_DYNAMICS:
560                                         {
561                                                 KX_SCA_DynamicActuator* tmpdynact = new KX_SCA_DynamicActuator(
562                                                             gameobj,
563                                                             editobact->dyn_operation,
564                                                             editobact->mass);
565                                                 baseact = tmpdynact;
566                                         }
567                                 }
568                                 break;
569                         }
570                 case ACT_CONSTRAINT:
571                         {
572                                 float min = 0.0, max = 0.0;
573                                 char *prop = NULL;
574                                 KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF;
575                                 bConstraintActuator *conact 
576                                         = (bConstraintActuator*) bact->data;
577                                 /* convert settings... degrees in the ui become radians  */ 
578                                 /* internally                                            */ 
579                                 if (conact->type == ACT_CONST_TYPE_ORI) {
580                                         min = (float)(((float)MT_2_PI * conact->minloc[0]) / 360.0f);
581                                         max = (float)(((float)MT_2_PI * conact->maxloc[0]) / 360.0f);
582                                         switch (conact->mode) {
583                                         case ACT_CONST_DIRPX:
584                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;
585                                                 break;
586                                         case ACT_CONST_DIRPY:
587                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY;
588                                                 break;
589                                         case ACT_CONST_DIRPZ:
590                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ;
591                                                 break;
592                                         }
593                                 } else if (conact->type == ACT_CONST_TYPE_DIST) {
594                                         switch (conact->mode) {
595                                         case ACT_CONST_DIRPX:
596                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPX;
597                                                 min = conact->minloc[0];
598                                                 max = conact->maxloc[0];
599                                                 break;
600                                         case ACT_CONST_DIRPY:
601                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY;
602                                                 min = conact->minloc[1];
603                                                 max = conact->maxloc[1];
604                                                 break;
605                                         case ACT_CONST_DIRPZ:
606                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPZ;
607                                                 min = conact->minloc[2];
608                                                 max = conact->maxloc[2];
609                                                 break;
610                                         case ACT_CONST_DIRNX:
611                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNX;
612                                                 min = conact->minloc[0];
613                                                 max = conact->maxloc[0];
614                                                 break;
615                                         case ACT_CONST_DIRNY:
616                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY;
617                                                 min = conact->minloc[1];
618                                                 max = conact->maxloc[1];
619                                                 break;
620                                         case ACT_CONST_DIRNZ:
621                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNZ;
622                                                 min = conact->minloc[2];
623                                                 max = conact->maxloc[2];
624                                                 break;
625                                         }
626                                         prop = conact->matprop;
627                                 } else if (conact->type == ACT_CONST_TYPE_FH) {
628                                         switch (conact->mode) {
629                                         case ACT_CONST_DIRPX:
630                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX;
631                                                 min = conact->minloc[0];
632                                                 max = conact->maxloc[0];
633                                                 break;
634                                         case ACT_CONST_DIRPY:
635                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY;
636                                                 min = conact->minloc[1];
637                                                 max = conact->maxloc[1];
638                                                 break;
639                                         case ACT_CONST_DIRPZ:
640                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ;
641                                                 min = conact->minloc[2];
642                                                 max = conact->maxloc[2];
643                                                 break;
644                                         case ACT_CONST_DIRNX:
645                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX;
646                                                 min = conact->minloc[0];
647                                                 max = conact->maxloc[0];
648                                                 break;
649                                         case ACT_CONST_DIRNY:
650                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY;
651                                                 min = conact->minloc[1];
652                                                 max = conact->maxloc[1];
653                                                 break;
654                                         case ACT_CONST_DIRNZ:
655                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ;
656                                                 min = conact->minloc[2];
657                                                 max = conact->maxloc[2];
658                                                 break;
659                                         }
660                                         prop = conact->matprop;
661                                 } else {
662                                         switch (conact->flag) {
663                                         case ACT_CONST_LOCX:
664                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX; 
665                                                 min = conact->minloc[0];
666                                                 max = conact->maxloc[0];
667                                                 break;
668                                         case ACT_CONST_LOCY:
669                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY; 
670                                                 min = conact->minloc[1];
671                                                 max = conact->maxloc[1];
672                                                 break;
673                                         case ACT_CONST_LOCZ:
674                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCZ;
675                                                 min = conact->minloc[2];
676                                                 max = conact->maxloc[2];
677                                                 break;
678                                         case ACT_CONST_ROTX:
679                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTX;
680                                                 min = conact->minrot[0] * (float)MT_RADS_PER_DEG;
681                                                 max = conact->maxrot[0] * (float)MT_RADS_PER_DEG;
682                                                 break;
683                                         case ACT_CONST_ROTY:
684                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTY;
685                                                 min = conact->minrot[1] * (float)MT_RADS_PER_DEG;
686                                                 max = conact->maxrot[1] * (float)MT_RADS_PER_DEG;
687                                                 break;
688                                         case ACT_CONST_ROTZ:
689                                                 locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ;
690                                                 min = conact->minrot[2] * (float)MT_RADS_PER_DEG;
691                                                 max = conact->maxrot[2] * (float)MT_RADS_PER_DEG;
692                                                 break;
693                                         default:
694                                                 ; /* error */ 
695                                         }
696                                 }
697                                 KX_ConstraintActuator *tmpconact = new KX_ConstraintActuator(
698                                             gameobj,
699                                             conact->damp,
700                                             conact->rotdamp,
701                                             min,
702                                             max,
703                                             conact->maxrot,
704                                             locrot,
705                                             conact->time,
706                                             conact->flag,
707                                             prop);
708                                 baseact = tmpconact;
709                                 break;
710                         }
711                 case ACT_GROUP:
712                         {
713                                 // deprecated
714                         }
715                         break;
716                 case ACT_SCENE:
717                         {
718                                 bSceneActuator *sceneact = (bSceneActuator *) bact->data;
719                                 STR_String nextSceneName("");
720                                 
721                                 KX_SceneActuator* tmpsceneact;
722                                 int mode = KX_SceneActuator::KX_SCENE_NODEF;
723                                 KX_Camera *cam = NULL;
724                                 //KX_Scene* scene = NULL;
725                                 switch (sceneact->type)
726                                 {
727                                 case ACT_SCENE_RESUME:
728                                 case ACT_SCENE_SUSPEND:
729                                 case ACT_SCENE_ADD_FRONT:
730                                 case ACT_SCENE_ADD_BACK:
731                                 case ACT_SCENE_REMOVE:
732                                 case ACT_SCENE_SET:
733                                         {
734                                                 switch (sceneact->type)
735                                                 {
736                                                 case ACT_SCENE_RESUME:
737                                                         mode = KX_SceneActuator::KX_SCENE_RESUME;
738                                                         break;
739                                                 case ACT_SCENE_SUSPEND:
740                                                         mode = KX_SceneActuator::KX_SCENE_SUSPEND;
741                                                         break;
742                                                 case ACT_SCENE_ADD_FRONT:
743                                                         mode = KX_SceneActuator::KX_SCENE_ADD_FRONT_SCENE;
744                                                         break;
745                                                 case ACT_SCENE_ADD_BACK:
746                                                         mode = KX_SceneActuator::KX_SCENE_ADD_BACK_SCENE;
747                                                         break;
748                                                 case ACT_SCENE_REMOVE:
749                                                         mode = KX_SceneActuator::KX_SCENE_REMOVE_SCENE;
750                                                         break;
751                                                 case ACT_SCENE_SET:
752                                                 default:
753                                                         mode = KX_SceneActuator::KX_SCENE_SET_SCENE;
754                                                         break;
755                                                 };
756                                                 
757                                                 if (sceneact->scene)
758                                                 {
759                                                         nextSceneName = sceneact->scene->id.name + 2; // this '2' is necessary to remove prefix 'SC'
760                                                 }
761                                                 
762                                                 break;
763                                         }
764                                 case ACT_SCENE_CAMERA:
765                                         mode = KX_SceneActuator::KX_SCENE_SET_CAMERA;
766                                         if (sceneact->camera)
767                                         {
768                                                 cam = (KX_Camera*) converter->FindGameObject(sceneact->camera);
769                                         }
770                                         break;
771                                 case ACT_SCENE_RESTART:
772                                         {
773                                                 
774                                                 mode =  KX_SceneActuator::KX_SCENE_RESTART;
775                                                 break;
776                                         }
777                                 default:
778                                         ; /* flag error */
779                                 }
780                                 tmpsceneact = new KX_SceneActuator(
781                                             gameobj,
782                                             mode,
783                                             scene,
784                                             ketsjiEngine,
785                                             nextSceneName,
786                                             cam);
787                                 baseact = tmpsceneact;
788                                 break;
789                         }
790                 case ACT_GAME:
791                         {
792                                 bGameActuator *gameact = (bGameActuator *) bact->data;
793                                 KX_GameActuator* tmpgameact;
794                                 STR_String filename = maggiename;
795                                 STR_String loadinganimationname = "";
796                                 int mode = KX_GameActuator::KX_GAME_NODEF;
797                                 switch (gameact->type)
798                                 {
799                                 case ACT_GAME_LOAD:
800                                         {
801                                                 mode = KX_GameActuator::KX_GAME_LOAD;
802                                                 filename = gameact->filename;
803                                                 loadinganimationname = gameact->loadaniname;
804                                                 break;
805                                         }
806                                 case ACT_GAME_START:
807                                         {
808                                                 mode = KX_GameActuator::KX_GAME_START;
809                                                 filename = gameact->filename;
810                                                 loadinganimationname = gameact->loadaniname;
811                                                 break;
812                                         }
813                                 case ACT_GAME_RESTART:
814                                         {
815                                                 mode = KX_GameActuator::KX_GAME_RESTART;
816                                                 break;
817                                         }
818                                 case ACT_GAME_QUIT:
819                                         {
820                                                 mode = KX_GameActuator::KX_GAME_QUIT;
821                                                 break;
822                                         }
823                                 case ACT_GAME_SAVECFG:
824                                         {
825                                                 mode = KX_GameActuator::KX_GAME_SAVECFG;
826                                                 break;
827                                         }
828                                 case ACT_GAME_LOADCFG:
829                                         {
830                                                 mode = KX_GameActuator::KX_GAME_LOADCFG;
831                                                 break;
832                                         }
833                                 default:
834                                         ; /* flag error */
835                                 }
836                                 tmpgameact = new KX_GameActuator(
837                                             gameobj,
838                                             mode,
839                                             filename,
840                                             loadinganimationname,
841                                             scene,
842                                             ketsjiEngine);
843                                 baseact = tmpgameact;
844
845                                 break;
846                         }
847                 case ACT_RANDOM:
848                         {
849                                 bRandomActuator *randAct 
850                                         = (bRandomActuator *) bact->data;
851                                 
852                                 unsigned long seedArg = randAct->seed;
853                                 if (seedArg == 0)
854                                 {
855                                         seedArg = (int)(ketsjiEngine->GetRealTime()*100000.0);
856                                         seedArg ^= (intptr_t)randAct;
857                                 }
858                                 SCA_RandomActuator::KX_RANDOMACT_MODE modeArg 
859                                         = SCA_RandomActuator::KX_RANDOMACT_NODEF;
860                                 SCA_RandomActuator *tmprandomact;
861                                 float paraArg1 = 0.0;
862                                 float paraArg2 = 0.0;
863                                 
864                                 switch (randAct->distribution) {
865                                 case ACT_RANDOM_BOOL_CONST:
866                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST;
867                                         paraArg1 = (float) randAct->int_arg_1;
868                                         break;
869                                 case ACT_RANDOM_BOOL_UNIFORM:
870                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_UNIFORM;
871                                         break;
872                                 case ACT_RANDOM_BOOL_BERNOUILLI:
873                                         paraArg1 = randAct->float_arg_1;
874                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_BERNOUILLI;
875                                         break;
876                                 case ACT_RANDOM_INT_CONST:
877                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_CONST;
878                                         paraArg1 = (float) randAct->int_arg_1;
879                                         break;
880                                 case ACT_RANDOM_INT_UNIFORM:
881                                         paraArg1 = (float) randAct->int_arg_1;
882                                         paraArg2 = (float) randAct->int_arg_2;
883                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_UNIFORM;
884                                         break;
885                                 case ACT_RANDOM_INT_POISSON:
886                                         paraArg1 = randAct->float_arg_1;
887                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_POISSON;
888                                         break;
889                                 case ACT_RANDOM_FLOAT_CONST:
890                                         paraArg1 = randAct->float_arg_1;
891                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_CONST;
892                                         break;
893                                 case ACT_RANDOM_FLOAT_UNIFORM:
894                                         paraArg1 = randAct->float_arg_1;
895                                         paraArg2 = randAct->float_arg_2;
896                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_UNIFORM;
897                                         break;
898                                 case ACT_RANDOM_FLOAT_NORMAL:
899                                         paraArg1 = randAct->float_arg_1;
900                                         paraArg2 = randAct->float_arg_2;
901                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NORMAL;
902                                         break;
903                                 case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
904                                         paraArg1 = randAct->float_arg_1;
905                                         modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL;
906                                         break;
907                                 default:
908                                         ; /* error */
909                                 }
910                                 tmprandomact = new SCA_RandomActuator(
911                                             gameobj,
912                                             seedArg,
913                                             modeArg,
914                                             paraArg1,
915                                             paraArg2,
916                                             randAct->propname);
917                                 baseact = tmprandomact;
918                         }
919                         break;
920
921                 case ACT_VISIBILITY:
922                 {
923                         bVisibilityActuator *vis_act = (bVisibilityActuator *) bact->data;
924                         KX_VisibilityActuator * tmp_vis_act = NULL;
925                         bool v = ((vis_act->flag & ACT_VISIBILITY_INVISIBLE) != 0);
926                         bool o = ((vis_act->flag & ACT_VISIBILITY_OCCLUSION) != 0);
927                         bool recursive = ((vis_act->flag & ACT_VISIBILITY_RECURSIVE) != 0);
928
929                         tmp_vis_act = new KX_VisibilityActuator(gameobj, !v, o, recursive);
930                         
931                         baseact = tmp_vis_act;
932                 }
933                 break;
934
935                 case ACT_STATE:
936                 {
937                         bStateActuator *sta_act = (bStateActuator *) bact->data;
938                         KX_StateActuator * tmp_sta_act = NULL;
939
940                         tmp_sta_act = 
941                                 new KX_StateActuator(gameobj, sta_act->type, sta_act->mask);
942                         
943                         baseact = tmp_sta_act;
944                 }
945                 break;
946
947                 case ACT_2DFILTER:
948                 {
949                         bTwoDFilterActuator *_2dfilter = (bTwoDFilterActuator*) bact->data;
950                         SCA_2DFilterActuator *tmp = NULL;
951
952                         RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode;
953                         switch (_2dfilter->type) {
954                                 case ACT_2DFILTER_MOTIONBLUR:
955                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR;
956                                         break;
957                                 case ACT_2DFILTER_BLUR:
958                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_BLUR;
959                                         break;
960                                 case ACT_2DFILTER_SHARPEN:
961                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SHARPEN;
962                                         break;
963                                 case ACT_2DFILTER_DILATION:
964                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_DILATION;
965                                         break;
966                                 case ACT_2DFILTER_EROSION:
967                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_EROSION;
968                                         break;
969                                 case ACT_2DFILTER_LAPLACIAN:
970                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_LAPLACIAN;
971                                         break;
972                                 case ACT_2DFILTER_SOBEL:
973                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SOBEL;
974                                         break;
975                                 case ACT_2DFILTER_PREWITT:
976                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_PREWITT;
977                                         break;
978                                 case ACT_2DFILTER_GRAYSCALE:
979                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_GRAYSCALE;
980                                         break;
981                                 case ACT_2DFILTER_SEPIA:
982                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_SEPIA;
983                                         break;
984                                 case ACT_2DFILTER_INVERT:
985                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_INVERT;
986                                         break;
987                                 case ACT_2DFILTER_CUSTOMFILTER:
988                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_CUSTOMFILTER;
989                                         break;
990                                 case ACT_2DFILTER_NOFILTER:
991                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER;
992                                         break;
993                                 case ACT_2DFILTER_DISABLED:
994                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_DISABLED;
995                                         break;
996                                 case ACT_2DFILTER_ENABLED:
997                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_ENABLED;
998                                         break;
999                                 default:
1000                                         filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER;
1001                                         break;
1002                         }
1003
1004                         tmp = new SCA_2DFilterActuator(gameobj, filtermode,  _2dfilter->flag,
1005                                                        _2dfilter->float_arg, _2dfilter->int_arg,
1006                                                        ketsjiEngine->GetRasterizer(), scene);
1007
1008                         if (_2dfilter->text)
1009                         {
1010                                 char *buf;
1011                                 // this is some blender specific code
1012                                 buf = txt_to_buf(_2dfilter->text);
1013                                 if (buf)
1014                                 {
1015                                         tmp->SetShaderText(buf);
1016                                         MEM_freeN(buf);
1017                                 }
1018                         }
1019
1020                         baseact = tmp;
1021
1022                 }
1023                 break;
1024                 case ACT_PARENT:
1025                         {
1026                                 bParentActuator *parAct = (bParentActuator *) bact->data;
1027                                 int mode = KX_ParentActuator::KX_PARENT_NODEF;
1028                                 bool addToCompound = true;
1029                                 bool ghost = true;
1030                                 KX_GameObject *tmpgob = NULL;
1031
1032                                 switch (parAct->type) {
1033                                         case ACT_PARENT_SET:
1034                                                 mode = KX_ParentActuator::KX_PARENT_SET;
1035                                                 tmpgob = converter->FindGameObject(parAct->ob);
1036                                                 addToCompound = !(parAct->flag & ACT_PARENT_COMPOUND);
1037                                                 ghost = !(parAct->flag & ACT_PARENT_GHOST);
1038                                                 break;
1039                                         case ACT_PARENT_REMOVE:
1040                                                 mode = KX_ParentActuator::KX_PARENT_REMOVE;
1041                                                 tmpgob = NULL;
1042                                                 break;
1043                                 }
1044         
1045                                 KX_ParentActuator *tmpparact
1046                                         = new KX_ParentActuator(gameobj,
1047                                         mode,
1048                                         addToCompound,
1049                                         ghost,
1050                                         tmpgob);
1051                                 baseact = tmpparact;
1052                                 break;
1053                         }
1054                 
1055                 case ACT_ARMATURE:
1056                         {
1057                                 bArmatureActuator* armAct = (bArmatureActuator*) bact->data;
1058                                 KX_GameObject *tmpgob = converter->FindGameObject(armAct->target);
1059                                 KX_GameObject *subgob = converter->FindGameObject(armAct->subtarget);
1060                                 BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(
1061                                             gameobj,
1062                                             armAct->type,
1063                                             armAct->posechannel,
1064                                             armAct->constraint,
1065                                             tmpgob,
1066                                             subgob,
1067                                             armAct->weight,
1068                                             armAct->influence);
1069                                 baseact = tmparmact;
1070                                 break;
1071                         }
1072                 case ACT_STEERING:
1073                         {
1074                                 bSteeringActuator *stAct = (bSteeringActuator *) bact->data;
1075                                 KX_GameObject *navmeshob = NULL;
1076                                 if (stAct->navmesh)
1077                                 {
1078                                         PointerRNA settings_ptr;
1079                                         RNA_pointer_create((ID *)stAct->navmesh, &RNA_GameObjectSettings, stAct->navmesh, &settings_ptr);
1080                                         if (RNA_enum_get(&settings_ptr, "physics_type") == OB_BODY_TYPE_NAVMESH)
1081                                                 navmeshob = converter->FindGameObject(stAct->navmesh);
1082                                 }
1083                                 KX_GameObject *targetob = converter->FindGameObject(stAct->target);
1084
1085                                 int mode = KX_SteeringActuator::KX_STEERING_NODEF;
1086                                 switch (stAct->type) {
1087                                 case ACT_STEERING_SEEK:
1088                                         mode = KX_SteeringActuator::KX_STEERING_SEEK;
1089                                         break;
1090                                 case ACT_STEERING_FLEE:
1091                                         mode = KX_SteeringActuator::KX_STEERING_FLEE;
1092                                         break;
1093                                 case ACT_STEERING_PATHFOLLOWING:
1094                                         mode = KX_SteeringActuator::KX_STEERING_PATHFOLLOWING;
1095                                         break;
1096                                 }
1097
1098                                 bool selfTerminated = (stAct->flag & ACT_STEERING_SELFTERMINATED) !=0;
1099                                 bool enableVisualization = (stAct->flag & ACT_STEERING_ENABLEVISUALIZATION) !=0;
1100                                 short facingMode = (stAct->flag & ACT_STEERING_AUTOMATICFACING) ? stAct->facingaxis : 0;
1101                                 bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0;
1102                                 KX_SteeringActuator *tmpstact
1103                                         = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, 
1104                                         stAct->velocity, stAct->acceleration, stAct->turnspeed, 
1105                                         selfTerminated, stAct->updateTime,
1106                                         scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization);
1107                                 baseact = tmpstact;
1108                                 break;
1109                         }
1110                 default:
1111                         ; /* generate some error */
1112                 }
1113                 
1114                 if (baseact)
1115                 {
1116                         baseact->SetExecutePriority(executePriority++);
1117                         uniquename += "#ACT#";
1118                         uniqueint++;
1119                         CIntValue* uniqueval = new CIntValue(uniqueint);
1120                         uniquename += uniqueval->GetText();
1121                         uniqueval->Release();
1122                         baseact->SetName(bact->name);
1123                         //gameobj->SetProperty(uniquename,baseact);
1124                         gameobj->AddActuator(baseact);
1125                         
1126                         converter->RegisterGameActuator(baseact, bact);
1127                         // done with baseact, release it
1128                         baseact->Release();
1129                 }
1130                 
1131                 bact = bact->next;
1132         }
1133 }
1134
1135