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